我用Python3笔记本设置了一个AI平台VM实例。我还有一个谷歌云存储桶,其中包含许多.CSV和.SAV文件。使用标准python包读取CSV文件中的数据并不困难,但我的笔记本似乎无法在存储桶中找到我的.SAV文件
有人知道这里发生了什么和/或我如何解决这个问题吗
import numpy as np
import pandas as pd
import pyreadstat
df = pd.read_spss("gs://<STORAGE_BUCKET>/datafile.sav")
---------------------------------------------------------------------------
PyreadstatError Traceback (most recent call last)
<ipython-input-10-30836249273f> in <module>
----> 1 df = pd.read_spss("gs://<STORAGE_BUCKET>/datafile.sav")
/opt/conda/lib/python3.7/site-packages/pandas/io/spss.py in read_spss(path, usecols, convert_categoricals)
41
42 df, _ = pyreadstat.read_sav(
---> 43 path, usecols=usecols, apply_value_formats=convert_categoricals
44 )
45 return df
pyreadstat/pyreadstat.pyx in pyreadstat.pyreadstat.read_sav()
pyreadstat/_readstat_parser.pyx in pyreadstat._readstat_parser.run_conversion()
PyreadstatError: File gs://<STORAGE_BUCKET>/datafile.sav does not exist!
^{} function 只能从本地文件路径读取:
将其与^{} function 进行比较:
相关问题 更多 >
编程相关推荐