You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import pandas as pd, numpy
r = numpy.empty((3,4))
index = pd.MultiIndex.from_tuples([('A','a'), ('A','b'), ('B','a'), ('B','b')])
df = pd.DataFrame(r, columns=index)
store = pd.HDFStore('df.h5')
store.put('data',df) #->OK
store.put('data1',df,table=True) #-> Ok
store.put('data2',df,table=True,data_columns=['A']) #-> Ok
store.put('data3',df,table=True,data_columns=True) #-> raises hell
#TypeError: not all arguments converted during string formatting
store['data']['A'] #->OK
store['data1']['A'] #-> KeyError KeyError: u'no item named A'
In [43]: df = store['data']
In [44]: df
Out[44]:
A B
a b a b
0 2 -1.727234e-77 2.964394e-323 0.000000e+00
1 0 0.000000e+00 0.000000e+00 0.000000e+00
2 0 0.000000e+00 0.000000e+00 8.344027e-309
In [45]: df = store['data1']
In [46]: df
Out[46]:
(A, a) (A, b) (B, a) (B, b)
0 2 -1.727234e-77 2.964394e-323 0.000000e+00
1 0 0.000000e+00 0.000000e+00 0.000000e+00
2 0 0.000000e+00 0.000000e+00 8.344027e-309
pd.__version__ -> '0.12.0'
The text was updated successfully, but these errors were encountered:
Once again, man: an instant reply. Thanks so much! Sorry I had to edit the code several times. I was copying and pasting from by REPL and my Editor and made a hash of it. I verified that the code as it stands now replicates the issue.
Also, exploiting you kindness, could you send me a link to how I can use MultiIndex for the select and select_as_multiple usages?
The text was updated successfully, but these errors were encountered: