Pandas 使用熊猫';读取\u hdf以在Google Drive上加载数据失败,返回ValueError

Pandas 使用熊猫';读取\u hdf以在Google Drive上加载数据失败,返回ValueError,pandas,google-colaboratory,Pandas,Google Colaboratory,我已经上传了一个HDF文件到谷歌硬盘,并希望加载到Colab。该文件是使用dataframe.to\u hdf()从数据帧创建的,可以使用pd.read\u hdf()在本地成功加载该文件。然而,当我尝试挂载我的谷歌硬盘并读取Colab中的数据时,它失败了,出现ValueError 下面是我用来读取数据的代码: from google.colab import drive drive.mount('/content/drive') data = pd.read_hdf('/content/dri

我已经上传了一个HDF文件到谷歌硬盘,并希望加载到Colab。该文件是使用
dataframe.to\u hdf()
从数据帧创建的,可以使用
pd.read\u hdf()
在本地成功加载该文件。然而,当我尝试挂载我的谷歌硬盘并读取Colab中的数据时,它失败了,出现
ValueError

下面是我用来读取数据的代码:

from google.colab import drive
drive.mount('/content/drive')
data = pd.read_hdf('/content/drive/My Drive/Ryhmäytyminen/data/data.h5', 'students')
这是完整的错误消息:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-15-cfe913c26e60> in <module>()
----> 1 data = pd.read_hdf('/content/drive/My Drive/Ryhmäytyminen/data/data.h5', 'students')

7 frames
/usr/local/lib/python3.6/dist-packages/tables/vlarray.py in read(self, start, stop, step)
    819             listarr = []
    820         else:
--> 821             listarr = self._read_array(start, stop, step)
    822 
    823         atom = self.atom

tables/hdf5extension.pyx in tables.hdf5extension.VLArray._read_array()

ValueError: cannot set WRITEABLE flag to True of this array
---------------------------------------------------------------------------
ValueError回溯(最近一次调用上次)
在()
---->1 data=pd.read_hdf('/content/drive/My drive/Ryhmäytyminen/data/data.h5','students')
7帧
/usr/local/lib/python3.6/dist-packages/tables/vlarray.py处于读取状态(self、start、stop、step)
819 listarr=[]
820其他:
-->821 listarr=self.\u read\u数组(开始、停止、步进)
822
823原子=self.atom
tables.hdf5extension.VLArray.\u read\u array()中的tables/hdf5extension.pyx
ValueError:无法将此数组的可写标志设置为True
读取一些JSON数据是成功的,因此问题可能不在于装载。有什么想法是错误的,或者如何调试这个问题吗


谢谢大家!

首先尝试导航到存储HDF文件的目录:

cd /content/drive/My Drive/Ryhmäytyminen/data
从这里,您应该能够直接加载HDF文件:

data = pd.read_hdf('data.h5', 'students')