Skip to content
Advertisement

Tag: drop

I’m trying to replace/convert all the A’s and B’s in a particular column to 1 and O in a csv file

This is the error i’m getting This is what i have tried repl = {‘Y’:’1′, ‘N’:’0′} prices_dataframe[‘col_state’] = prices_dataframe[‘col_state’].replace(repl, regex=True) Answer The replace() method is unique to strings, and at some point the value you are trying to replace is being a boolean (True or False). If you still want to replace it, you can transform the value into a

Advertisement