Reputation: 1636
I have a dataframe which looks as follows:
It is shown as empty. But when I check the value
df4.iloc[195]
it returns 0 of object type.
I want to remove it from my dataframe. I tried
df4.replace(0, np.nan, inplace=True)
But it is still present as an empty cell with 0 value. I also tried replacing "" with
np.nan
And I also tried using
regex=True
However, the problem seems to persist. Therefore, I cannot covert the pandas dataframe into a numeric type. What would be a good way to solve this issue?
.
Upvotes: 0
Views: 58
Reputation: 323226
Try with convert to to_numeric
df4 = df4.apply(lambda x : pd.to_numeric(x, errors='coerce'))
df4 = df4.dropna()
Upvotes: 1