I have a CSV
df = pd.read_csv('data.csv')
Table:
Column A | Column B | Column C |
---|---|---|
4068744 | -1472525 | 2596219 |
198366 | - | - |
The file is using '-' for nul values
I tried converting to int without handling that '-'.
My question is: how do I strip the string '-' without changing the negative values?
df['Column B'] = df['Column B'].astype(int)
ValueError: invalid literal for int() with base 10: '-'