value_counts(bins) not working with xlwings

Viewed 21

I've written this UDF that works perfectly in Excel:

@xw.func
@xw.arg("x", pd.DataFrame, index=False)
@xw.ret(expand="table")
def funzione2(x):
    return x.value_counts(sort= False)

but as soon as I pass the bin argument

@xw.func
@xw.arg("x", pd.DataFrame, index=False)
@xw.ret(expand="table")
def funzione2(x):
    return x.value_counts(bins=[400, 500, 600, 650, 670, 700, 800], sort= False)

I get the following error:

TypeError: DataFrame.value_counts() got an unexpected keyword argument 'bins'

Why is it so, and how can I fix the issue?

0 Answers
Related