df.loc function doesn't seem to work properly for my DataFrame. I think it has something to do with the reader library I have chosen. Since I'm importing a .sav file b' ' prefix appears in every column, so in the name column, df['name'] b'Steve' appears.
I have used .str.decode('utf-8') to remove this prefix, but I can't seem to slice my df using df.loc[df['name'] == 'Sam'] For example. What is going on here?
# Read in Data
with sRW.SavReaderNp('C:/Users/Sam/Downloads/Data.sav') as reader:
record = reader.all()
df = pd.DataFrame(record)
# Decode
df['name'] = df['name'].str.decode('utf-8')
# Slice
df.loc[df['name'] == 'Sam']