I've ran into a problem grouping with HDFStore which turned out to extend to selecting rows based on strings that contain the '&' character. This should illustrate the problem
>>> from pandas import HDFStore, DataFrame
>>> df = DataFrame({'a': ['a', 'a', 'c', 'b', 'test & test', 'c' , 'b', 'e'],
'b': [1, 2, 3, 4, 5, 6, 7, 8]})
>>> store = HDFStore('test.h5')
>>> store.append('test', df, format='table', data_columns=True)
>>> df[df.a == 'test & test']
a b 4 test & test 5
>>> store.select('test', 'a="test & test"')
Int64Index([], dtype='int64') Empty DataFrame
Now I'm wondering if I'm missing something from the documentation or if this is a bug.
As commented, this is now fixed (since pandas 0.14):
In [11]: df[df.a == 'test & test']
Out[11]:
a b
4 test & test 5
In [12]: store.select('test', 'a="test & test"')
Out[12]:
a b
4 test & test 5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With