Using dask.array.stats.ttest_1samp with dask series

Hello all,
I am trying to use dask.array.stats.ttest_1samp, but get this exception:

>>> series
Dask Series Structure:
npartitions=1
1.0       float64
5000.0        ...
Name: price_for_one, dtype: float64
Dask Name: getitem, 3 tasks
>>> dask.array.stats.ttest_1samp(series, 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../venv/lib/python3.8/site-packages/dask/array/stats.py", line 104, in ttest_1samp
    denom = da.sqrt(v / float(n))
TypeError: float() argument must be a string or a number, not 'Scalar'

In source of this function I can see that they trying to cast dask scalar task to float that raises Exception.
It looks like bug, but may be I am doing something wrong?

@fi11er Sorry for the dealy in response!

stats.ttest_1samp is a Dask Array function, while series is a Dask DataFrame Series. Could you try converting it to a Dask Array and retrying it?

Code: series.to_dask_array()

If it still doesn’t work, it’ll be great if you can a minimal example, it will allow us to help you better!

Also, I see this is your first post, welcome! :sparkles: