How to get Text from b'Text' in the pandas object type after using read_sas?

前端 未结 3 470
死守一世寂寞
死守一世寂寞 2021-02-04 08:21

I\'m trying to read the data from .sas7bdat format of SAS using pandas function read_sas:

import pandas as pd
df = pd.read_sas(\'D:/input/houses.sas7bdat\', form         


        
3条回答
  •  情歌与酒
    2021-02-04 09:07

    First, figure out your sas dataset encoding. In SAS, run proc contents on the dataset. Check the "Encoding". In my case, my encoding was "latin1 Western (ISO)". Then enter your encoding as such:

    df = pd.read_sas('filename', format = 'sas7bdat', encoding = 'latin-1')
    

提交回复
热议问题