成功解决RuntimeError: Decompression ‘SNAPPY‘ not available. Options: [‘GZIP‘, ‘UNCOMPRESSED‘]
成功解决RuntimeError: Decompression 'SNAPPY' not available. Options: ['GZIP', 'UNCOMPRESSED']
解决问题
D:\ProgramData\Anaconda3\python.exe E:/Python_Program/0925KBQNodel/抗辩期模型_v01_1105.py
Traceback (most recent call last):
File "E:/Python_Program/0925KBQNodel/抗辩期模型_v01_1105.py", line 31, in <module>
df = pd.read_parquet('./data_contest_20201022_sample.parquet')
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parquet.py", line 317, in read_parquet
return impl.read(path, columns=columns, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\pandas\io\parquet.py", line 212, in read
return parquet_file.to_pandas(columns=columns, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\api.py", line 399, in to_pandas
index=index, assign=parts)
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\api.py", line 228, in read_row_group
scheme=self.file_scheme)
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\core.py", line 355, in read_row_group
cats, selfmade, assign=assign)
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\core.py", line 332, in read_row_group_arrays
catdef=out.get(name+'-catdef', None))
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\core.py", line 199, in read_col
dic = read_dictionary_page(infile, schema_helper, ph, cmd)
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\core.py", line 157, in read_dictionary_page
raw_bytes = _read_page(file_obj, page_header, column_metadata)
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\core.py", line 25, in _read_page
column_metadata.codec,
File "D:\ProgramData\Anaconda3\lib\site-packages\fastparquet\compression.py", line 128, in decompress_data
(algorithm.upper(), sorted(decompressions)))
RuntimeError: Decompression 'SNAPPY' not available. Options: ['GZIP', 'UNCOMPRESSED']
解决思路
运行时错误:解压“SNAPPY”不可用。选择:(GZIP,“压缩”)
解决方法
pip install python-snappy
pip install pyarrow
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple python-snappy
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyarrow
哈哈,大功告成!