这是我的代码:
import os
import pandas as pd
def load_hdf(filename):
"""
Load the first key of an HDF file
"""
hdf = pd.HDFStore(filename,mode = 'r')
keys = hdf.keys()
if not keys:
hdf.close()
return pd.DataFrame()
data_df = hdf.get(keys[0])
hdf.close()
return data_df当我这么做的时候
load_hdf(os.path.join(PATH, 'crm.hd5'))我有一个错误:
HDFStore requires PyTables, "No module named 'tables'" problem importing当我尝试:
pip install tables我有一个错误:
Using Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
* USE_PKGCONFIG: False
.. ERROR:: Could not find a local HDF5 installation.
You may need to explicitly state where your local HDF5 headers and library can be found by setting the ``HDF5_DIR`` environment variable or by using the ``--hdf5`` command-line option.
...
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2s/sn3gzfwd6_37v0ggqd0n8qy00000gn/T/pip-install-1mx6wjd3/tables/我已经有了hdf5在我的Anaconda中。我有Python 3.7。
发布于 2019-01-29 10:56:35
我还安装了pytable,无法找到解决方案。对我起作用的是安装HDF5 2.8.0rc1的发布候选版本(如here所示)。似乎熊猫安装的HDF5版本不完全兼容。所以试着:
pip install h5py==2.8.0rc1希望能帮上忙。
https://stackoverflow.com/questions/53959457
复制相似问题