BUG: multi-index HDFStore data_columns=True
This commit is contained in:
parent
725453deb2
commit
5d32610587
|
@ -58,7 +58,7 @@ Bug Fixes
|
|||
|
||||
|
||||
|
||||
|
||||
- Bug ``HDFStore`` writing a ``MultiIndex`` when using ``data_columns=True`` (:issue:`14435`)
|
||||
|
||||
|
||||
- Bug in clipboard functions on linux with python2 with unicode and separators (:issue:`13747`)
|
||||
|
|
|
@ -4254,7 +4254,7 @@ class AppendableMultiFrameTable(AppendableFrameTable):
|
|||
if data_columns is None:
|
||||
data_columns = []
|
||||
elif data_columns is True:
|
||||
data_columns = obj.columns[:]
|
||||
data_columns = obj.columns.tolist()
|
||||
obj, self.levels = self.validate_multiindex(obj)
|
||||
for n in self.levels:
|
||||
if n not in data_columns:
|
||||
|
|
|
@ -1818,6 +1818,19 @@ class TestHDFStore(Base, tm.TestCase):
|
|||
store.put('s', s, format='table')
|
||||
tm.assert_series_equal(store.select('s', where="columns=['A']"), s)
|
||||
|
||||
def test_mi_data_columns(self):
|
||||
# GH 14435
|
||||
idx = pd.MultiIndex.from_arrays([date_range('2000-01-01', periods=5),
|
||||
range(5)], names=['date', 'id'])
|
||||
df = pd.DataFrame({'a': [1.1, 1.2, 1.3, 1.4, 1.5]}, index=idx)
|
||||
|
||||
with ensure_clean_store(self.path) as store:
|
||||
store.append('df', df, data_columns=True)
|
||||
|
||||
actual = store.select('df', where='id == 1')
|
||||
expected = df.iloc[[1], :]
|
||||
tm.assert_frame_equal(actual, expected)
|
||||
|
||||
def test_pass_spec_to_storer(self):
|
||||
|
||||
df = tm.makeDataFrame()
|
||||
|
|
Loading…
Reference in New Issue