xorbits icon indicating copy to clipboard operation
xorbits copied to clipboard

BUG: df.map_chunk with empty DataFrame cannot work

Open qinxuye opened this issue 1 year ago • 0 comments

Describe the bug

df.map_chunk with empty DataFrame cannot work.

To Reproduce

To help us to reproduce this bug, please provide information below:

  1. Your Python version
  2. The version of Xorbits you use
  3. Versions of crucial packages, such as numpy, scipy and pandas
  4. Full stack of the error.
  5. Minimized code to reproduce the error.
In [2]: import xorbits

In [3]: xorbits.init()
2023-09-26 15:55:08,918 xorbits._mars.deploy.oscar.local 86719 WARNING  Web service started at http://0.0.0.0:36934

In [4]: df = pd.DataFrame(columns=['a', 'b', 'c'])

In [5]: def p(d):
   ...:     if not len(d):
   ...:         return pd.DataFrame([[None] * d.shape[1]], columns=d.columns)
   ...:     else:
   ...:         return d
   ...: 

In [6]: df.map_chunk(p)  # should not be empty
100%|████████████████████████████████████| 100.00/100 [00:00<00:00, 2450.02it/s]

Empty DataFrame
Columns: [a, b, c]
Index: []

qinxuye avatar Sep 26 '23 07:09 qinxuye