相关疑难解决方法(0)

将HDF5文件读取到带有条件的pandas DataFrame

我有一个巨大的HDF5文件,我想在pandas DataFrame中加载它的一部分来执行一些操作,但我有兴趣过滤一些行.

我可以通过一个例子更好地解释:

原始HDF5文件看起来像:

A    B    C    D
1    0    34   11
2    0    32   15
3    1    35   22
4    1    34   15
5    1    31   9
1    0    34   15
2    1    29   11
3    0    34   15
4    1    12   14
5    0    34   15
1    0    32   13
2    1    34   15
etc  etc  etc  etc
Run Code Online (Sandbox Code Playgroud)

我想要做的是将它完全按原样加载到pandas Dataframe中,但仅限于此 where A==1 or 3 or 4

到现在为止我可以使用以下方法加载整个HDF5:

store = pd.HDFStore('Resutls2015_10_21.h5')
df = pd.DataFrame(store['results_table'])
Run Code Online (Sandbox Code Playgroud)

我不知道如何在where这里包含一个条件.

python hdf5 pandas

7
推荐指数
1
解决办法
8724
查看次数

标签 统计

hdf5 ×1

pandas ×1

python ×1