我遇到了一個HDFStore問題分組,後來證明這個分組基於包含'&'字符的字符串來選擇行。這應該說明問題熊貓和HDF5,查詢一個表,包含'&'字符的字符串
>>> 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
現在我如果我錯過從documentation的東西,或者如果這是一個錯誤疑惑。
錯誤....在這裏看到:https://github.com/pydata/pandas/issues/6351;我不覺得很難解決,我們有一個預解析器,基本上可以替代某些表達式;需要讓它不會在引號內做到 – Jeff
明白了,謝謝! –
這只是合併在......所以請嘗試與主! – Jeff