[dask] Fix empty partition with pandas input. (#7644)

Empty partition is different from empty dataset.  For the former case, each worker has
non-empty dask collections, but each collection might contain empty partition.
This commit is contained in:
Jiaming Yuan
2022-02-14 19:35:51 +08:00
committed by GitHub
parent 1f020a6097
commit b52c4e13b0
3 changed files with 34 additions and 12 deletions

View File

@@ -1062,6 +1062,9 @@ def _maybe_dataframe(
prediction, columns=columns, dtype=numpy.float32, index=index
)
else:
if prediction.size == 0:
return DataFrame({}, columns=columns, dtype=numpy.float32, index=index)
prediction = DataFrame(
prediction, columns=columns, dtype=numpy.float32, index=index
)