xorbitsai / xorbits

Scalable Python DS & ML, in an API compatible & lightning fast way.
https://xorbits.io
Apache License 2.0
1.06k stars 67 forks source link

BUG: Unclear error reporting when groupby apply func is wrong #690

Open ChengjieLi28 opened 10 months ago

ChengjieLi28 commented 10 months ago

Note that the issue tracker is NOT the place for general support. For discussions about development, questions about usage, or any general questions, contact us on https://discuss.xorbits.io/. Reproduce:

import xorbits.pandas as pd

df = pd.DataFrame({'a': [20200101], "b": ["test"]})

def t(x):
    # should be startswith
    return x[x.str.starts_with("te")].count()

print(df.groupby("a", as_index=False)["b"].apply(t))

The example above raises:

TypeError: Cannot determine dtypes by calculating with enumerate data, please specify it as arguments

However, this is just a typo error in udf t. The error message is unclear.