Reputation: 393
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
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