-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Pandas read_sas error: 'ascii' codec can't decode byte 0xd8 in position 0: ordinal not in range(128) #12809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Are you able to share that file, or a similar file with non-senstitive data that raises the same error? |
well this is the problem.. I cant. but I can do my best to run tests on my side, or do stuff in sas, or whatever you need to sort out the problem |
You said the lines were long and span several lines. Can you make a dummy file with long names (just random strings like Actually, this might be a dupe of #12659 Can you try reading the file linked there and see if the same error is raised? |
when I try to read that file, I get |
Just making sure, did you click on the |
yes, I dowloaded the file test17.sas7bdat. This is not the error expected? |
I checked the details of the file in SAS. Apparently it is encoded in latin 1 western. -- ascii codec cant decode byte etc.. |
Sorry, I was mistaken about the error message. Looks like this is a different issue. |
something strange is that even if I specify some encoding, I still get some error relative to the ascii codec. Can that be a cause of the error? |
the encoding of my sas file is more precisely latin1 western ISO. Created in linux. (but I use pandas on windows) |
Can you drop into the debugger after it raises the error? The docstring says |
aha! ok lemme try the debugger |
|
this is what I get. then the debugger seems to wait for instructions |
Ahh, that looks promising though. Does Although, that might not go well with the bit stripping there... |
what do you mean? what should I do? |
OK Tom, I found a fix. Just check the encoding of your sas file (right click, properties, details) and set the encoding. import sys the question I have is thus: why specifying the encoding in the read_sas function does nothing? |
I believe the |
According to the docs below, depending on the setting of the VALIDVARNAME I'm not sure if this VALIDVARNAME (which I have never heard of before) is Also relevant: http://support.sas.com/documentation/cdl/en/nlsref/61893/HTML/default/viewer.htm#a002601944.htm On Wed, Apr 6, 2016 at 8:27 AM, Tom Augspurger [email protected]
|
yes, makes sense although I dont have any control over the creation of these sas files. |
I'm working on a PR #12656 and will I haven't had much time lately but will try to get to this next week. Kerby On Wed, Apr 6, 2016 at 9:02 AM, randomgambit [email protected]
|
@randomgambit, can you try this branch against your SAS file: https://github.com/kshedden/pandas/tree/sas7bdat_perf I hope it fixes your problem. |
Hello everybody,
I am using Pandas 0.18 to open a
sas7bdat
datasetI simply use:
and I get the following error
If I use
I get
Other
sas7bdat
files in my folder are handled just fine by Pandas.When I open the file in SAS I see that the column names are very long and span several lines, but otherwise the files look just fine.
There are not so many possible options in
read_sas
... what should I do? Is this a bug inread_sas
?Many thanks!
The text was updated successfully, but these errors were encountered: