Skip to content

Commit 3fceb8b

Browse files
committed
convert memory expensive dask example docs to verbatim
1 parent c34685a commit 3fceb8b

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

doc/dask.rst

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,22 @@ will return a Dask delayed object that can be computed later.
125125

126126
A dataset can also be converted to a Dask DataFrame using :py:meth:`~xarray.Dataset.to_dask_dataframe`.
127127

128-
.. ipython:: python
128+
.. ipython::
129+
:verbatim:
129130

130-
df = ds.to_dask_dataframe()
131-
df
131+
In [8]: df = ds.to_dask_dataframe()
132+
133+
In [9]: df
134+
Out[9]:
135+
Dask DataFrame Structure:
136+
latitude longitude time temperature
137+
npartitions=44
138+
0 float64 int64 datetime64[ns] float64
139+
525600 ... ... ... ...
140+
... ... ... ... ...
141+
22600800 ... ... ... ...
142+
23651999 ... ... ... ...
143+
Dask Name: concat-indexed, 1481 tasks
132144

133145
Dask DataFrames do not support multi-indexes so the coordinate variables from the dataset are included as columns in the Dask DataFrame.
134146

@@ -226,10 +238,22 @@ NumPy ufuncs like ``np.sin`` currently only work on eagerly evaluated arrays
226238
replacements that also work on all xarray objects, including those that store
227239
lazy Dask arrays, in the :ref:`xarray.ufuncs <api.ufuncs>` module:
228240

229-
.. ipython:: python
241+
.. ipython::
242+
:verbatim:
243+
244+
In [16]: import xarray.ufuncs as xu
245+
246+
In [17]: xu.sin(rechunked)
247+
Out[17]:
248+
<xarray.Dataset>
249+
Dimensions: (latitude: 180, longitude: 360, time: 365)
250+
Coordinates:
251+
* time (time) datetime64[ns] 2015-01-01 2015-01-02 ... 2015-12-31
252+
* longitude (longitude) int64 0 1 2 3 4 5 6 ... 353 354 355 356 357 358 359
253+
* latitude (latitude) float64 89.5 88.5 87.5 86.5 ... -87.5 -88.5 -89.5
254+
Data variables:
255+
temperature (time, latitude, longitude) float64 0.4521 -0.2791 ... 0.005886
230256

231-
import xarray.ufuncs as xu
232-
xu.sin(rechunked)
233257

234258
To access Dask arrays directly, use the new
235259
:py:attr:`DataArray.data <xarray.DataArray.data>` attribute. This attribute exposes

0 commit comments

Comments
 (0)