Closed blue-cat-whale closed 1 month ago
This is a consequence of not fully supporting wrapped numpy arrays when using cudf.pandas. See the feature issue here: https://github.com/rapidsai/cudf/issues/15397
The broad problem is that because numpy has a C API, providing proxied objects like with do with pandas and cudf.pandas is more difficult.
As a consequence, although when you call to_numpy()
on a cudf.pandas Series you get something that behaves like a numpy array, we do not answer "yes" to the question isinstance(numpy_like_thing, np.ndarray)
.
I'm going to leave this open for a little while I look into #14537
This is a consequence of not fully supporting wrapped numpy arrays when using cudf.pandas. See the feature issue here: #15397
The broad problem is that because numpy has a C API, providing proxied objects like with do with pandas and cudf.pandas is more difficult.
As a consequence, although when you call
to_numpy()
on a cudf.pandas Series you get something that behaves like a numpy array, we do not answer "yes" to the questionisinstance(numpy_like_thing, np.ndarray)
.
The function requires a numpy array. Is it possible to make small changes to my code such that we can bypass that problem (still using the tl.MACD function while cudf active)?
The function requires a numpy array. Is it possible to make small changes to my code such that we can bypass that problem (still using the tl.MACD function while cudf active)?
With cudf.pandas activated, you can obtain a real numpy array from a Series
by using numpy.asarray
rather than to_numpy()
. This works seamlessly with real pandas Series
objects as well:
So try:
macd_dif, macd_dea, macd_bar = tl.MACD(np.asarray(signal), ema1, ema2, dem)
One thing to note is that you should treat the view you get back from np.asarray
as a read-only view. There are some circumstances in which we can propagate writes back to the original fast-slow signal
object, but many in which we can't (that needs #15397 to be solved properly).
However, if you're just doing this to pass the series as input to a third-party library, the above should work well.
Problem comes from line 62 inside function
my_func_single
. Code:Error:
package version:
The relevant package in the above code: