Skip to main content
 首页 » 编程设计

python之在 .sas7bdat 中编码

2025年05月04日14duanxz

我正在尝试使用 pandas 函数 read_sas(版本 0.17)导入 sas 数据集(.sas7bdat 格式),但出现以下错误:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 12: ordinal not in range(128)

请您参考如下方法:

使用编码='iso-8859-1'

pd.read_sas(filepath, format = 'sas7bdat', encoding='iso-8859-1')