drop columns with all null values pandas code example
Example 1: dropping nan in pandas dataframe
df.dropna(subset=['name', 'born'])
Example 2: pandas remove rows with null in column
df = df[df['EPS'].notna()]
Example 3: Returns a new DataFrame omitting rows with null values
# Returns a new DataFrame omitting rows with null values
df4.na.drop().show()
# +---+------+-----+
# |age|height| name|
# +---+------+-----+
# | 10| 80|Alice|
# +---+------+-----+