how to delete nan code example Example 1: how to delete nan values in python x = x[~numpy.isnan(x)] Example 2: python remove nan rows df = df[df['my_var'].notna()]