Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在PyTables表中存储DataFrame而不存储索引_Python_Pandas_Pytables - Fatal编程技术网

Python 在PyTables表中存储DataFrame而不存储索引

Python 在PyTables表中存储DataFrame而不存储索引,python,pandas,pytables,Python,Pandas,Pytables,在许多DataFrame.to_foo函数中,我可以指定我不想写入索引 >>> help(df.to_csv) Write DataFrame to a comma-separated values (csv) file Parameters ---------- ... index : boolean, default True Write row names (index) ... 数据帧到hdf是否有类似的功能?我不想将索引存储在PyTables表中。您可以

在许多
DataFrame.to_foo
函数中,我可以指定我不想写入索引

>>> help(df.to_csv)

Write DataFrame to a comma-separated values (csv) file

Parameters
----------
...
index : boolean, default True
    Write row names (index)
...

数据帧到hdf是否有类似的功能?我不想将索引存储在PyTables表中。

您可以调用h5py并直接与HDF5交互

data = df.values
with h5py.File('data.h5','w') as f:
    f.create_dataset('my_table', data=data)

抑制索引不是熊猫的开箱即用。该问题的跟踪时间为


这不是一个选项;我想可能是的,但无论如何你几乎总是需要它