Skip to content

Commit

Permalink
Update dropna docstring (pydata#9257)
Browse files Browse the repository at this point in the history
Co-authored-by: Deepak Cherian <[email protected]>
  • Loading branch information
TomNicholas and dcherian authored Jul 18, 2024
1 parent b55c783 commit 3013fb4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6371,7 +6371,7 @@ def dropna(
Data variables:
temperature (time, location) float64 64B 23.4 24.1 nan ... 24.2 20.5 25.3
# Drop NaN values from the dataset
Drop NaN values from the dataset
>>> dataset.dropna(dim="time")
<xarray.Dataset> Size: 80B
Expand All @@ -6382,7 +6382,7 @@ def dropna(
Data variables:
temperature (time, location) float64 48B 23.4 24.1 21.8 24.2 20.5 25.3
# Drop labels with any NAN values
Drop labels with any NaN values
>>> dataset.dropna(dim="time", how="any")
<xarray.Dataset> Size: 80B
Expand All @@ -6393,7 +6393,7 @@ def dropna(
Data variables:
temperature (time, location) float64 48B 23.4 24.1 21.8 24.2 20.5 25.3
# Drop labels with all NAN values
Drop labels with all NAN values
>>> dataset.dropna(dim="time", how="all")
<xarray.Dataset> Size: 104B
Expand All @@ -6404,7 +6404,7 @@ def dropna(
Data variables:
temperature (time, location) float64 64B 23.4 24.1 nan ... 24.2 20.5 25.3
# Drop labels with less than 2 non-NA values
Drop labels with less than 2 non-NA values
>>> dataset.dropna(dim="time", thresh=2)
<xarray.Dataset> Size: 80B
Expand All @@ -6418,6 +6418,11 @@ def dropna(
Returns
-------
Dataset
See Also
--------
DataArray.dropna
pandas.DataFrame.dropna
"""
# TODO: consider supporting multiple dimensions? Or not, given that
# there are some ugly edge cases, e.g., pandas's dropna differs
Expand Down

0 comments on commit 3013fb4

Please sign in to comment.