0

Before reading into pandas my data looks like in sas dataset

Name 
Alfred
Alice

After reading into pandas data is getting as

Name 
b'Alfred'
b'Alice'

Why I am getting the data is different? Steps followed:

  1. Import pandas as pd
  2. df=pd.read_sas(r'C:/ProgramData/Anaconda3/Python_local/class.sas7bdat',format='sas7bdat')

Need your help.

2
  • Please check this stackoverflow.com/questions/40389764/… Commented Jan 14, 2020 at 6:31
  • 1
    It is actually the same. SAS stores bytes you get bytes. It is only how python present bytes Commented Jan 14, 2020 at 12:22

1 Answer 1

0

SAS files need to be imported with special encoding

df=pd.read_sas(r'C:/ProgramData/Anaconda3/Python_local/class.sas7bdat',format='sas7bdat', encoding='iso-8859-1') 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.