modin 'Series' object has no attribute 'asi8'
See original GitHub issueSystem information
OS X 11.6.4 Modin version ‘0.15.2’ Python 3.9.12
Describe the problem
Subtracting a DatetimeIndex
and a modin Series fails since modin Series doesn’t have asi8
attribute.
Source code / logs
>>> import modin.pandas as pd
>>> df = pd.DataFrame({'date':[1,2,3,4]})
UserWarning: Distributing <class 'dict'> object. This may take some time.
>>> df['dob'] = pd.date_range(start='1/1/1930', periods=len(df), freq='D')
>>> df['date'] = pd.date_range(start='1/1/1982', periods=len(df), freq='D')
>>> df.set_index('date', inplace=True)
>>> print(type(df.index))
<class 'pandas.core.indexes.datetimes.DatetimeIndex'>
>>> print(type(df.dob))
<class 'modin.pandas.series.Series'>
>>> df.index - df.dob
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/ops/common.py", line 70, in new_method
return method(self, other)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/arraylike.py", line 108, in __sub__
return self._arith_method(other, operator.sub)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 6717, in _arith_method
return super()._arith_method(other, op)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/base.py", line 1295, in _arith_method
result = ops.arithmetic_op(lvalues, rvalues, op)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/ops/array_ops.py", line 216, in arithmetic_op
res_values = op(left, right)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/ops/common.py", line 70, in new_method
return method(self, other)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/arrays/datetimelike.py", line 1340, in __sub__
result = self._sub_datetime_arraylike(other)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/pandas/core/arrays/datetimes.py", line 738, in _sub_datetime_arraylike
other_i8 = other.asi8
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/modin/logging/logger_metaclass.py", line 68, in log_wrap
return method(*args, **kwargs)
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/modin/pandas/series.py", line 335, in __getattr__
raise e
File "/usr/local/Caskroom/miniforge/base/envs/enobase3/lib/python3.9/site-packages/modin/pandas/series.py", line 331, in __getattr__
return object.__getattribute__(self, key)
AttributeError: 'Series' object has no attribute 'asi8'
Issue Analytics
- State:
- Created a year ago
- Comments:15 (15 by maintainers)
Top Results From Across the Web
How to solve type object 'Series' has no attribute '_get_dtypes ...
It looks like that Modin version, which you are using, is old enough. I don't have the issue on the latest master. Please,...
Read more >AttributeError: type object 'Series' has no attribute 'tz' #2481
System information OS Platform and Distribution (Google Colab): Modin version (0.8.2): Python version: 3.6.
Read more >DataFrame Module Overview - Modin
DataFrame API is backed by a distributed object providing an identical API to pandas. ... Modin DataFrame or Series passed with data parameter....
Read more >Using Pandas on Ray (Modin) — Ray 2.2.0
You can use Modin on Ray with your laptop or cluster. In this document, we show instructions for how to set up a...
Read more >A Sample-Based Approach towards Privacy-Friendly Data ...
With regard to the latter, thorough data refinement in terms of data cleansing and data transformation is the decisive cornerstone. Studies show that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is ostensibly supported but really not advisable https://github.com/pandas-dev/pandas/issues/45289
Looks like the fundamental problem here is that
pd.Index.__sub__(ModinSeries)
is not returningNotImplemented
. The reversed opdf["dob"].__rsub__(df.index)
works as expected.A hacky-but-feasible solution would be to implement Series.asi8 to return ser.to_numpy().view(“i8”).
The correct solution is going to have to live upstream, same underlying issue as https://github.com/pandas-dev/pandas/issues/38946