File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ Breaking changes
85
85
Bug fixes
86
86
~~~~~~~~~
87
87
88
+ - Avoid in-memory broadcasting when converting to a dask dataframe
89
+ using ``.to_dask_dataframe. `` (:issue: `6811 `, :pull: `7472 `).
90
+ By `Jimmy Westling <https://github.com/illviljan >`_.
88
91
- Accessing the property ``.nbytes `` of a DataArray, or Variable no longer
89
92
accidentally triggers loading the variable into memory.
90
93
- Allow numpy-only objects in :py:func: `where ` when ``keep_attrs=True `` (:issue: `7362 `, :pull: `7364 `).
Original file line number Diff line number Diff line change @@ -6403,6 +6403,11 @@ def to_dask_dataframe(
6403
6403
if isinstance (var , IndexVariable ):
6404
6404
var = var .to_base_variable ()
6405
6405
6406
+ # Make sure var is a dask array, otherwise the array can become too large
6407
+ # when it is broadcasted to several dimensions:
6408
+ if not is_duck_dask_array (var ._data ):
6409
+ var = var .chunk ()
6410
+
6406
6411
dask_array = var .set_dims (ordered_dims ).chunk (self .chunks ).data
6407
6412
series = dd .from_array (dask_array .reshape (- 1 ), columns = [name ])
6408
6413
series_list .append (series )
You can’t perform that action at this time.
0 commit comments