id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type
1723010051,I_kwDOAMm_X85mswwD,7871,Nan Values never get deleted,7091088,closed,0,,,12,2023-05-24T01:13:41Z,2023-05-30T14:40:51Z,2023-05-30T14:40:50Z,NONE,,,,"### What is your issue?

Hi team, 
This could be pretty basic, but I'm missing where I'm going wrong
My xarray dataset : 
``` python
<xarray.Dataset>
Dimensions:              (x: 171, y: 128, time: 3287, bnds: 2)
Coordinates:
  * x                    (x) float64 -5.344e+05 -5.281e+05 ... 5.281e+05
  * y                    (y) float64 -1.959e+06 -1.953e+06 ... -1.166e+06
  * time                 (time) datetime64[ns] 2013-01-01 ... 2021-12-31
Dimensions without coordinates: bnds
Data variables:
    polar_stereographic  int32 ...
    z                    (time, y, x) float32 nan nan nan nan ... nan nan nan
    x_bnds               (x, bnds) float64 ...
    time_bnds            (time, bnds) datetime64[ns] ...
Attributes:
    author:       University of Bremen, Gunnar Spreen [gunnar.spreen@uni-brem...
    Conventions:  CF-1.5
    GMT_version:  5.2.1 (r15220) [64-bit] [MP]
    history:      Mon Jan 21 19:54:59 2019: GDAL CreateCopy( /ssmi/www/htdocs...
    info:         AMSR2 sea ice concentration based on the ASI algorithm (Spr...
    title:        Produced by grdmath
    GDAL:         GDAL 2.1.3, released 2017/20/01
```
Converted to dataframe to drop ""Nan"" values
![image](https://github.com/pydata/xarray/assets/7091088/7863767d-74ac-4b83-9b57-49baf0f24e3e)

I used 
```python 
df = ds['z'].to_dataframe().dropna()
```
Looks fine now
![image](https://github.com/pydata/xarray/assets/7091088/2816369f-55da-4921-b8e1-0ba98d3518c4)

But, after saving it back to xarray
```python
ds = df.to_xarray()
```
the Nan values never dropped and can be seen.
![image](https://github.com/pydata/xarray/assets/7091088/9546f74d-33da-48fa-b307-a0aebe0fa8a7)

Where am I going wrong?

Also, I'm assuming dropna() would by default drop all nan's in all dimensions.
(Ref: 
1)https://www.digitalocean.com/community/tutorials/pandas-dropna-drop-null-na-values-from-dataframe
2) https://stackoverflow.com/questions/39128856/python-drop-row-if-two-columns-are-nan)

Also, if I'm trying to drop along column's,  
something like: 
```python
df2.dropna(subset=[1, 2], axis=1)
```
it rasies error.
Ref screenshot:
![image](https://github.com/pydata/xarray/assets/7091088/735e66bb-ee9b-4d52-a0da-6be92a6e687f)

Any help would be highly appreciated
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7871/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue