1>>> df.dropna(inplace=True)
2>>> df
3 name toy born
41 Batman Batmobile 1940-04-25
5
1>>> df.dropna(subset=['name', 'toy'])
2 name toy born
31 Batman Batmobile 1940-04-25
42 Catwoman Bullwhip NaT
5
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]})
5df
6# o/p
7# name toy born
8# 0 Alfred NaN NaT
9# 1 Batman Batmobile 1940-04-25
10# 2 Catwoman Bullwhip NaT
11
12
13# Drop the rows where at least one element is missing.
14df.dropna()
15# o/p
16# name toy born
17# 1 Batman Batmobile 1940-04-25
18
19# ref. https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.dropna.html