Skip to content

Commit

Permalink
DOC: fix doc builds w.r.t. to_xarray
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Feb 10, 2016
1 parent d207679 commit e78c61f
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,9 +1050,37 @@ def to_xarray(self):
a Dataset for a DataFrame
a DataArray for higher dims
See Also
Examples
--------
`xarray docs <http://xarray.pydata.org/en/stable/>`__
>>> df = DataFrame({'A' : [1, 2, 3], 'B' : ['foo', 'bar', 'baz']})
>>> df.to_xarray()
<xarray.Dataset>
Dimensions: (index: 3)
Coordinates:
* index (index) int64 0 1 2
Data variables:
A (index) int64 1 2 3
B (index) object 'foo' 'bar' 'baz'
>>> p = pd.Panel(np.arange(6).reshape(3,2,1))
>>> p.to_xarray()
<xarray.DataArray (items: 3, major_axis: 2, minor_axis: 1)>
array([[[0],
[1]],
[[2],
[3]],
[[4],
[5]]])
Coordinates:
* items (items) int64 0 1 2
* major_axis (major_axis) int64 0 1
* minor_axis (minor_axis) int64 0
Notes
-----
See also the `xarray docs <http://xarray.pydata.org/en/stable/>`__
"""
import xarray
if self.ndim == 1:
Expand Down

0 comments on commit e78c61f

Please sign in to comment.