I have a pandas
DataFrame
that I want to separate into observations for which there are no missing values and observations with missing values. I can use dropna()
to get rows without missing values. Is there any analog to get rows with missing values?
#Example DataFrame
import pandas as pd
df = pd.DataFrame({'col1': [1,np.nan,3,4,5],'col2': [6,7,np.nan,9,10],})
#Get observations without missing values
df.dropna()