简体   繁体   English

用熊猫读取SAS文件

[英]Read SAS file with pandas

I'm trying to use the pandas read_sas() function.我正在尝试使用 pandas read_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 .我正在使用熊猫版本0.18.0

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM