我有一个名为myfile.zip
的zip文件,其中包含一个mysasfile.sas7bdat
文件,我想将其作为数据帧读取。我试过一些没用的方法,但我现在的方法是:
import zipfile
zipfile = zipfile.ZipFile('myfile.zip', 'r')
sasfile = zipfile.open('mysasfile.sas7bdat')
df = pd.read_sas(sasfile)
错误:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-82-6d55436287b5> in <module>()
3 imgfile = archive.open('curated_dataset_preview.sas7bdat')
4
----> 5 df = pd.read_sas(imgfile)
/opt/python/python35/lib/python3.5/site-packages/pandas/io/sas/sasreader.py in read_sas(filepath_or_buffer, format, index, encoding, chunksize, iterator)
38 filepath_or_buffer = _stringify_path(filepath_or_buffer)
39 if not isinstance(filepath_or_buffer, compat.string_types):
---> 40 raise ValueError(buffer_error_msg)
41 try:
42 fname = filepath_or_buffer.lower()
ValueError: If this is a buffer object rather than a string name, you must specify a format string
缺少参数
format
相关问题 更多 >
编程相关推荐