Skip to content

Commit c101d30

Browse files
authored
Backport PR pandas-dev#57510 on branch 2.2.x (DOC: Fix xarray example) (pandas-dev#57538)
DOC: Fix xarray example (pandas-dev#57510) * DOC: Fix xarray example * Update * Skip doctest * Igore another doctest --------- Co-authored-by: Matthew Roeschke <[email protected]> (cherry picked from commit 33a1cd7)
1 parent 0b49cf3 commit c101d30

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

pandas/core/generic.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -3278,18 +3278,18 @@ def to_xarray(self):
32783278
2 lion mammal 80.5 4
32793279
3 monkey mammal NaN 4
32803280
3281-
>>> df.to_xarray()
3281+
>>> df.to_xarray() # doctest: +SKIP
32823282
<xarray.Dataset>
32833283
Dimensions: (index: 4)
32843284
Coordinates:
3285-
* index (index) int64 0 1 2 3
3285+
* index (index) int64 32B 0 1 2 3
32863286
Data variables:
3287-
name (index) object 'falcon' 'parrot' 'lion' 'monkey'
3288-
class (index) object 'bird' 'bird' 'mammal' 'mammal'
3289-
max_speed (index) float64 389.0 24.0 80.5 nan
3290-
num_legs (index) int64 2 2 4 4
3287+
name (index) object 32B 'falcon' 'parrot' 'lion' 'monkey'
3288+
class (index) object 32B 'bird' 'bird' 'mammal' 'mammal'
3289+
max_speed (index) float64 32B 389.0 24.0 80.5 nan
3290+
num_legs (index) int64 32B 2 2 4 4
32913291
3292-
>>> df['max_speed'].to_xarray()
3292+
>>> df['max_speed'].to_xarray() # doctest: +SKIP
32933293
<xarray.DataArray 'max_speed' (index: 4)>
32943294
array([389. , 24. , 80.5, nan])
32953295
Coordinates:
@@ -3311,7 +3311,7 @@ class (index) object 'bird' 'bird' 'mammal' 'mammal'
33113311
2018-01-02 falcon 361
33123312
parrot 15
33133313
3314-
>>> df_multiindex.to_xarray()
3314+
>>> df_multiindex.to_xarray() # doctest: +SKIP
33153315
<xarray.Dataset>
33163316
Dimensions: (date: 2, animal: 2)
33173317
Coordinates:

0 commit comments

Comments
 (0)