I have a Panda's DataFrame and in an specific column, there are some values of different type than the desired one. I've tried to use a similar approach like the one exposed here, but it doesn't work. In my case some rows store floats
and others store strings
, I want to keep only the strings
.
This is what I tried.
import pandas as pd
d = {"name": [1.0, 2.0, "hello", "world"]}
df = pd.DataFrame(d)
print df
print df[(type(df["name"]) == type("str"))]
Obviously, I got an error related to a KeyError
.