Use df.dropna() to remove every row in a pandas DataFrame that contains at least one value pandas recognizes as missing. It returns a new DataFrame and leaves the original unchanged unless you use inplace=True.
Drop rows that contain any missing value
The default behavior removes a row if even one of its values is missing:
As an Amazon Associate I earn from qualifying purchases.
cleaned = df.dropna()
Assign the result back to df if you want to keep using that variable name:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsdf = df.dropna()
By default, the surviving rows keep their existing index labels. To give them a fresh sequential index instead, use ignore_index=True (available for DataFrame.dropna since pandas 2.0.0). See the pandas DataFrame.dropna API reference.
#1 Best Overall
Choose which rows to remove
Use the rule that matches your data-cleaning goal. These options apply to rows unless you set a different axis.
| Goal | Code | Effect |
|---|---|---|
| Drop a row if any value is missing | df.dropna() or df.dropna(how="any") |
Removes rows with one or more missing values. |
| Drop only rows where every value is missing | df.dropna(how="all") |
Keeps rows that have at least one observed value. |
| Check only required columns | df.dropna(subset=["name", "toy"]) |
Removes rows missing a value in either listed column; other columns do not determine whether the row is kept. |
| Require a minimum number of observed values | df.dropna(thresh=2) |
Keeps rows with at least two non-missing values. |
thresh cannot be combined with how. The documented interface uses keyword-only parameters, so write arguments by name rather than relying on their position. For example:
Rank #2
cleaned = df.dropna(axis=0, subset=["required_column"])
The default axis is rows (axis=0). To remove columns containing missing values instead, use df.dropna(axis="columns"); with its default how="any", a column is dropped if it contains at least one missing value. These behaviors and options are documented in the pandas DataFrame.dropna API reference.
Recommended Free Tools
What counts as a missing value?
dropna removes values pandas recognizes as missing, including np.nan, pd.NaT, and None. An empty string ("") is not automatically treated as missing, so a row containing one will not be dropped for that reason alone. If you are unsure how pandas interprets values in your data, inspect them with isna(). The pandas Series.dropna documentation demonstrates these missing-value cases.
Keep rows while handling missing values
Dropping rows reduces the observations available for later analysis. If you need to retain rows, DataFrame.fillna can replace missing values with a scalar or a mapping from column names to replacement values. Choose replacements based on what each value means in your data; zero is not a safe default unless zero is meaningful. See the pandas DataFrame.fillna API reference.
Assign the result or use inplace=True
By default, df.dropna() returns a DataFrame and does not change df. Prefer assigning the result when you want to retain the cleaned data. With inplace=True, pandas modifies the DataFrame and returns None:
df.dropna(inplace=True)
Do not assign that call back to df: df = df.dropna(inplace=True) would replace the variable with None.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




