@@ -125,10 +125,22 @@ will return a Dask delayed object that can be computed later.
125
125
126
126
A dataset can also be converted to a Dask DataFrame using :py:meth: `~xarray.Dataset.to_dask_dataframe `.
127
127
128
- .. ipython :: python
128
+ .. ipython ::
129
+ :verbatim:
129
130
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
132
144
133
145
Dask DataFrames do not support multi-indexes so the coordinate variables from the dataset are included as columns in the Dask DataFrame.
134
146
@@ -226,10 +238,22 @@ NumPy ufuncs like ``np.sin`` currently only work on eagerly evaluated arrays
226
238
replacements that also work on all xarray objects, including those that store
227
239
lazy Dask arrays, in the :ref: `xarray.ufuncs <api.ufuncs >` module:
228
240
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
230
256
231
- import xarray.ufuncs as xu
232
- xu.sin(rechunked)
233
257
234
258
To access Dask arrays directly, use the new
235
259
:py:attr: `DataArray.data <xarray.DataArray.data> ` attribute. This attribute exposes
0 commit comments