I have a data frame looks like this:
import numpy as np
import pandas as pd
data = {'datetime' : ['2009-07-24 02:00:00', '2009-07-24 03:00:00','2009-07-24 04:00:00'],
'value1' : ['a', np.nan ,'c'],
'value2' : ['d','e','f']}
df = pd.DataFrame(data)
df = df.set_index(pd.DatetimeIndex(df['datetime']))
missing = df.loc[:, df.columns != ('datetime')]
the data above is just a sample. but let say I have a lot of missing values in bigger data. I want to select all the data with missing values in 'value1' column.
missing_index = df[df['value1'].isnull()].index
this code will let get me all the indices of missing values, but I want the actual rows of them, in this case, second row.
So, I tried,
df[missing_index]
but I am having an error saying
KeyError: "DatetimeIndex(['2009-07-24 03:00:00'], dtype='datetime64[ns]', name='datetime', freq=None) not in index"
df[df['value1'].isnull()]?