Here's my problem: I have a column of numbers in pandas.dataFrame
. But there are certain numbers that need to be converted because they might be string
's.
Here's how the column currently looks:
[1
-1,650.00
-3
...]
I want it all to be integers. My code was:
df['columnname'].astype(int)
However, when I convert -1,650.00
to integer
I'm getting an error. Even when the code is
df['columnname'].astype(float)
df['columnname'].astype(int)
It still doesn't solve the problem. It says could not convert string to float: -
and the "-" is still not handled.