BangolPhoenix
BangolPhoenix

Reputation: 393

I want to get rid of "-"(dash) in csv file(in Pandas)

I have csv files and in the table, when there's no number, it has dash signs.

All I know to solve it is to replace "-" with "" but it will affect "minus" signs.

What should I do to remove dash signs when it's not actually minus signs followed by numbers?

Thank you

Upvotes: 1

Views: 1611

Answers (1)

fmarm
fmarm

Reputation: 4284

You can directly remove those signs when you convert the csv to a pandas dataframe

df = pd.read_csv("yourfile.csv",na_values=["-"])

Upvotes: 4

Related Questions