Skip to content

TST: remove tests and docs for legacy (pre 0.12) hdf5 support #17404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions doc/source/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4419,44 +4419,6 @@ Now you can import the ``DataFrame`` into R:
starting point if you have stored multiple ``DataFrame`` objects to a
single HDF5 file.

Backwards Compatibility
'''''''''''''''''''''''

0.10.1 of ``HDFStore`` can read tables created in a prior version of pandas,
however query terms using the
prior (undocumented) methodology are unsupported. ``HDFStore`` will
issue a warning if you try to use a legacy-format file. You must
read in the entire file and write it out using the new format, using the
method ``copy`` to take advantage of the updates. The group attribute
``pandas_version`` contains the version information. ``copy`` takes a
number of options, please see the docstring.


.. ipython:: python
:suppress:

import os
legacy_file_path = os.path.abspath('source/_static/legacy_0.10.h5')

.. ipython:: python
:okwarning:

# a legacy store
legacy_store = pd.HDFStore(legacy_file_path,'r')
legacy_store

# copy (and return the new handle)
new_store = legacy_store.copy('store_new.h5')
new_store
new_store.close()

.. ipython:: python
:suppress:

legacy_store.close()
import os
os.remove('store_new.h5')


Performance
'''''''''''
Expand Down
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.21.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ Removal of prior version deprecations/changes
- ``Categorical`` has dropped the ``.order()`` and ``.sort()`` methods in favor of ``.sort_values()`` (:issue:`12882`)
- :func:`eval` and :func:`DataFrame.eval` have changed the default of ``inplace`` from ``None`` to ``False`` (:issue:`11149`)
- The function ``get_offset_name`` has been dropped in favor of the ``.freqstr`` attribute for an offset (:issue:`11834`)
- pandas no longer tests for compatibility with hdf5-files created with pandas < 0.11 (:issue:`17404`).



.. _whatsnew_0210.performance:
Expand Down
Binary file removed pandas/tests/io/data/legacy_hdf/legacy_0.10.h5
Binary file not shown.
Binary file not shown.
34 changes: 1 addition & 33 deletions pandas/tests/io/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -4599,41 +4599,13 @@ def test_legacy_table_read(self):
expected = df2[df2.index > df2.index[2]]
assert_frame_equal(expected, result)

def test_legacy_0_10_read(self):
# legacy from 0.10
with catch_warnings(record=True):
path = tm.get_data_path('legacy_hdf/legacy_0.10.h5')
with ensure_clean_store(path, mode='r') as store:
str(store)
for k in store.keys():
store.select(k)

def test_legacy_0_11_read(self):
# legacy from 0.11
path = os.path.join('legacy_hdf', 'legacy_table_0.11.h5')
with ensure_clean_store(tm.get_data_path(path), mode='r') as store:
str(store)
assert 'df' in store
assert 'df1' in store
assert 'mi' in store
df = store.select('df')
df1 = store.select('df1')
mi = store.select('mi')
assert isinstance(df, DataFrame)
assert isinstance(df1, DataFrame)
assert isinstance(mi, DataFrame)

def test_copy(self):

with catch_warnings(record=True):

def do_copy(f=None, new_f=None, keys=None,
def do_copy(f, new_f=None, keys=None,
propindexes=True, **kwargs):
try:
if f is None:
f = tm.get_data_path(os.path.join('legacy_hdf',
'legacy_0.10.h5'))

store = HDFStore(f, 'r')

if new_f is None:
Expand Down Expand Up @@ -4671,10 +4643,6 @@ def do_copy(f=None, new_f=None, keys=None,
pass
safe_remove(new_f)

do_copy()
do_copy(keys=['/a', '/b', '/df1_mixed'])
do_copy(propindexes=False)

# new table
df = tm.makeDataFrame()

Expand Down