Skip to content

Commit 13068fd

Browse files
committed
Improve dropna() documentation with examples for how='all' and thresh
1 parent 7bfef3b commit 13068fd

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

pandas/core/frame.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6655,7 +6655,29 @@ def dropna(
66556655
ignore_index: bool = False,
66566656
) -> DataFrame | None:
66576657
"""
6658-
Remove missing values.
6658+
Examples
6659+
--------
6660+
>>> df = pd.DataFrame({
6661+
... 'A': [None, None, 3],
6662+
... 'B': [None, 2, 3],
6663+
... 'C': [None, None, None]
6664+
... })
6665+
>>> df.dropna(how='all')
6666+
A B C
6667+
1 NaN 2.0 NaN
6668+
2 3.0 3.0 NaN
6669+
6670+
>>> df = pd.DataFrame({
6671+
... 'A': [1, None, None],
6672+
... 'B': [None, 2, None],
6673+
... 'C': [None, None, 3]
6674+
... })
6675+
>>> df.dropna(thresh=2)
6676+
A B C
6677+
0 1.0 NaN NaN
6678+
1 NaN 2.0 NaN
6679+
6680+
Remove missing values.
66596681
66606682
See the :ref:`User Guide <missing_data>` for more on which values are
66616683
considered missing, and how to work with missing data.

0 commit comments

Comments
 (0)