Skip to content

Commit 69271b3

Browse files
committed
DEPR: Remove the table keyword in HDFStore.put/append, in favor of using format= #4645
1 parent 78f3c80 commit 69271b3

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

doc/source/whatsnew/v0.17.0.txt

+7
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,13 @@ Removal of prior version deprecations/changes
705705

706706
df.add(df.A,axis='index')
707707

708+
709+
710+
711+
- Remove the ``table`` keyword in ``HDFStore.put/append``, in favor of using ``format=`` (:issue:`4645`)
712+
713+
714+
708715
.. _whatsnew_0170.performance:
709716

710717
Performance Improvements

pandas/io/pytables.py

-11
Original file line numberDiff line numberDiff line change
@@ -1117,17 +1117,6 @@ def _validate_format(self, format, kwargs):
11171117
""" validate / deprecate formats; return the new kwargs """
11181118
kwargs = kwargs.copy()
11191119

1120-
# table arg
1121-
table = kwargs.pop('table', None)
1122-
1123-
if table is not None:
1124-
warnings.warn(format_deprecate_doc, FutureWarning)
1125-
1126-
if table:
1127-
format = 'table'
1128-
else:
1129-
format = 'fixed'
1130-
11311120
# validate
11321121
try:
11331122
kwargs['format'] = _FORMAT_MAP[format.lower()]

pandas/io/tests/test_pytables.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ def test_append_all_nans(self):
10401040
store.append('df2', df[10:], dropna=False)
10411041
tm.assert_frame_equal(store['df2'], df)
10421042

1043-
# Test to make sure defaults are to not drop.
1043+
# Test to make sure defaults are to not drop.
10441044
# Corresponding to Issue 9382
10451045
df_with_missing = DataFrame({'col1':[0, np.nan, 2], 'col2':[1, np.nan, np.nan]})
10461046

@@ -1059,7 +1059,7 @@ def test_append_all_nans(self):
10591059

10601060
with ensure_clean_path(self.path) as path:
10611061
panel_with_missing.to_hdf(path, 'panel_with_missing', format='table')
1062-
reloaded_panel = read_hdf(path, 'panel_with_missing')
1062+
reloaded_panel = read_hdf(path, 'panel_with_missing')
10631063
tm.assert_panel_equal(panel_with_missing, reloaded_panel)
10641064

10651065
def test_append_frame_column_oriented(self):
@@ -2440,9 +2440,9 @@ def test_terms(self):
24402440
p4d = tm.makePanel4D()
24412441
wpneg = Panel.fromDict({-1: tm.makeDataFrame(), 0: tm.makeDataFrame(),
24422442
1: tm.makeDataFrame()})
2443-
store.put('wp', wp, table=True)
2444-
store.put('p4d', p4d, table=True)
2445-
store.put('wpneg', wpneg, table=True)
2443+
store.put('wp', wp, format='table')
2444+
store.put('p4d', p4d, format='table')
2445+
store.put('wpneg', wpneg, format='table')
24462446

24472447
# panel
24482448
result = store.select('wp', [Term(
@@ -2607,7 +2607,7 @@ def test_same_name_scoping(self):
26072607

26082608
import pandas as pd
26092609
df = DataFrame(np.random.randn(20, 2),index=pd.date_range('20130101',periods=20))
2610-
store.put('df', df, table=True)
2610+
store.put('df', df, format='table')
26112611
expected = df[df.index>pd.Timestamp('20130105')]
26122612

26132613
import datetime
@@ -3608,7 +3608,7 @@ def test_frame_select_complex(self):
36083608
df.loc[df.index[0:4],'string'] = 'bar'
36093609

36103610
with ensure_clean_store(self.path) as store:
3611-
store.put('df', df, table=True, data_columns=['string'])
3611+
store.put('df', df, format='table', data_columns=['string'])
36123612

36133613
# empty
36143614
result = store.select('df', 'index>df.index[3] & string="bar"')
@@ -3717,7 +3717,7 @@ def test_invalid_filtering(self):
37173717
df = tm.makeTimeDataFrame()
37183718

37193719
with ensure_clean_store(self.path) as store:
3720-
store.put('df', df, table=True)
3720+
store.put('df', df, format='table')
37213721

37223722
# not implemented
37233723
self.assertRaises(NotImplementedError, store.select, 'df', "columns=['A'] | columns=['B']")

0 commit comments

Comments
 (0)