Reputation: 2273
I have a df with lots of rows.
Price Time Place
A 5.1 11.30 germany
B 4.1 08.30 lebannon
...
DY 7.49 01.15 italy
DZ 2.13 02.35 england
How could I filter the df to obtain those rows where column Price
has a Nan
value?
So far I tried
df[~df['Price'].str.isnumeric()]
but didn't worked.
The desired output would be something like this:
Price Time Place
AS Nan 11.30 germany
BJ Nan 08.30 lebannon
Upvotes: 1
Views: 451
Reputation: 143
Try using this :
df = df.ix[df.price.isnull(),:]
or
df = df.loc[df.price.isnull(),:]
Upvotes: 0
Reputation: 294258
use isnull
df[df.Price.isnull()]
You can also use np.isnan
df[np.isnan(df.Price.values)]
Upvotes: 1