1# importing pandas module
2import pandas as pd
3
4# making data frame from csv file
5data = pd.read_csv("nba.csv")
6
7# making new data frame with dropped NA values
8new_data = data.dropna(axis = 0, how ='any')
9
10
11
1df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
2... "toy": [np.nan, 'Batmobile', 'Bullwhip'],
3... "born": [pd.NaT, pd.Timestamp("1940-04-25"),
4... pd.NaT]})
5>>> df
6 name toy born
70 Alfred NaN NaT
81 Batman Batmobile 1940-04-25
92 Catwoman Bullwhip NaT
10
11##Drop the rows where at least one element is missing.
12>>> df.dropna()
13 name toy born
141 Batman Batmobile 1940-04-25