I need some help... I got some troubles reading my sas table in python using the pandas function read_sas. I got the following error:
"ValueError: Length of values does not match length of index".
Here is the code I run:
import pandas as pd
data=pd.read_sas("my_table.sas7bdat")
data.head()
My sas table is pretty big with 505 columns and 100 000 rows.
Thanks all for your help.
I had the same problem with few sas files. I solved it in 2 ways: 1. encoding
df=pd.read_csv('foo.sas7bdat.csv', encoding='iso-8859-1')
2. With sas7bdat library installed in Anaconda with:
conda install -c prometeia/label/pytho sas7bdat
In python file:
from sas7bdat import SAS7BDAT
f=SAS7BDAT('foo.sas7bdat').to_data_frame()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With