drop nan from numpy array code example Example 1: python remove nan rows df = df[df['my_var'].notna()] Example 2: remove nana from np array x = x[~numpy.isnan(x)]