Skip to content

Commit 2ca823b

Browse files
author
tp
committed
remove tests and docs for legacy hdf5-pandas support (pandas<0.11)
1 parent 77bfe21 commit 2ca823b

File tree

4 files changed

+2
-95
lines changed

4 files changed

+2
-95
lines changed

doc/source/io.rst

-38
Original file line numberDiff line numberDiff line change
@@ -4419,44 +4419,6 @@ Now you can import the ``DataFrame`` into R:
44194419
starting point if you have stored multiple ``DataFrame`` objects to a
44204420
single HDF5 file.
44214421

4422-
Backwards Compatibility
4423-
'''''''''''''''''''''''
4424-
4425-
0.10.1 of ``HDFStore`` can read tables created in a prior version of pandas,
4426-
however query terms using the
4427-
prior (undocumented) methodology are unsupported. ``HDFStore`` will
4428-
issue a warning if you try to use a legacy-format file. You must
4429-
read in the entire file and write it out using the new format, using the
4430-
method ``copy`` to take advantage of the updates. The group attribute
4431-
``pandas_version`` contains the version information. ``copy`` takes a
4432-
number of options, please see the docstring.
4433-
4434-
4435-
.. ipython:: python
4436-
:suppress:
4437-
4438-
import os
4439-
legacy_file_path = os.path.abspath('source/_static/legacy_0.10.h5')
4440-
4441-
.. ipython:: python
4442-
:okwarning:
4443-
4444-
# a legacy store
4445-
legacy_store = pd.HDFStore(legacy_file_path,'r')
4446-
legacy_store
4447-
4448-
# copy (and return the new handle)
4449-
new_store = legacy_store.copy('store_new.h5')
4450-
new_store
4451-
new_store.close()
4452-
4453-
.. ipython:: python
4454-
:suppress:
4455-
4456-
legacy_store.close()
4457-
import os
4458-
os.remove('store_new.h5')
4459-
44604422

44614423
Performance
44624424
'''''''''''

doc/source/whatsnew/v0.21.0.txt

+2
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ Removal of prior version deprecations/changes
317317
- ``Categorical`` has dropped the ``.order()`` and ``.sort()`` methods in favor of ``.sort_values()`` (:issue:`12882`)
318318
- :func:`eval` and :func:`DataFrame.eval` have changed the default of ``inplace`` from ``None`` to ``False`` (:issue:`11149`)
319319
- The function ``get_offset_name`` has been dropped in favor of the ``.freqstr`` attribute for an offset (:issue:`11834`)
320+
- pandas no longer tests for compatibility with hdf5-files created with pandas < 0.11 (:issue:`17398`).
321+
320322

321323

322324
.. _whatsnew_0210.performance:
-233 KB
Binary file not shown.

pandas/tests/io/test_pytables.py

-57
Original file line numberDiff line numberDiff line change
@@ -4599,15 +4599,6 @@ def test_legacy_table_read(self):
45994599
expected = df2[df2.index > df2.index[2]]
46004600
assert_frame_equal(expected, result)
46014601

4602-
def test_legacy_0_10_read(self):
4603-
# legacy from 0.10
4604-
with catch_warnings(record=True):
4605-
path = tm.get_data_path('legacy_hdf/legacy_0.10.h5')
4606-
with ensure_clean_store(path, mode='r') as store:
4607-
str(store)
4608-
for k in store.keys():
4609-
store.select(k)
4610-
46114602
def test_legacy_0_11_read(self):
46124603
# legacy from 0.11
46134604
path = os.path.join('legacy_hdf', 'legacy_table_0.11.h5')
@@ -4627,54 +4618,6 @@ def test_copy(self):
46274618

46284619
with catch_warnings(record=True):
46294620

4630-
def do_copy(f=None, new_f=None, keys=None,
4631-
propindexes=True, **kwargs):
4632-
try:
4633-
if f is None:
4634-
f = tm.get_data_path(os.path.join('legacy_hdf',
4635-
'legacy_0.10.h5'))
4636-
4637-
store = HDFStore(f, 'r')
4638-
4639-
if new_f is None:
4640-
import tempfile
4641-
fd, new_f = tempfile.mkstemp()
4642-
4643-
tstore = store.copy(
4644-
new_f, keys=keys, propindexes=propindexes, **kwargs)
4645-
4646-
# check keys
4647-
if keys is None:
4648-
keys = store.keys()
4649-
assert set(keys) == set(tstore.keys())
4650-
4651-
# check indicies & nrows
4652-
for k in tstore.keys():
4653-
if tstore.get_storer(k).is_table:
4654-
new_t = tstore.get_storer(k)
4655-
orig_t = store.get_storer(k)
4656-
4657-
assert orig_t.nrows == new_t.nrows
4658-
4659-
# check propindixes
4660-
if propindexes:
4661-
for a in orig_t.axes:
4662-
if a.is_indexed:
4663-
assert new_t[a.name].is_indexed
4664-
4665-
finally:
4666-
safe_close(store)
4667-
safe_close(tstore)
4668-
try:
4669-
os.close(fd)
4670-
except:
4671-
pass
4672-
safe_remove(new_f)
4673-
4674-
do_copy()
4675-
do_copy(keys=['/a', '/b', '/df1_mixed'])
4676-
do_copy(propindexes=False)
4677-
46784621
# new table
46794622
df = tm.makeDataFrame()
46804623

0 commit comments

Comments
 (0)