remove lines containing nans in a dataframe code example Example 1: drop null rows pandas df.dropna() Example 2: python remove nan rows df = df[df['my_var'].notna()]