pandas 用熊猫读取SAS文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36310319/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 00:57:41  来源:igfitidea点击:

Read SAS file with pandas

pythonpandassas

提问by itzy

I'm trying to use the pandas read_sas()function.

我正在尝试使用Pandasread_sas()功能。

First, I create a SAS dataset by running this code in SAS:

首先,我通过在 SAS 中运行此代码来创建一个 SAS 数据集:

libname tmp 'c:\temp';  
data tmp.test;
    do i=1 to 100;
        x=rannor(0);
        output;
    end;
run;

Now, in IPython, I do this:

现在,在 IPython 中,我这样做:

import numpy as np
import pandas as pd

%cd C:\temp
pd.read_sas('test.sas7bdat')

Pretty straightforward and seems like it should work. But I just get this error:

非常简单,似乎应该可以工作。但我只是收到这个错误:

TypeError: read() takes at most 1 argument (2 given)

What am I missing here? I'm using pandas version 0.18.0.

我在这里错过了什么?我正在使用Pandas版本0.18.0

回答by TED Zhao

According issue report linked below, this bug will be fixed in 18.1.

根据下面链接的问题报告,此错误将在 18.1 中修复。

https://github.com/pydata/pandas/issues/12647

https://github.com/pydata/pandas/issues/12647