question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

modin 'Series' object has no attribute 'asi8'

See original GitHub issue

System 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:open
  • Created a year ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
jbrockmendelcommented, Jul 6, 2022

we can try to subclass pd.Index instead

This is ostensibly supported but really not advisable https://github.com/pandas-dev/pandas/issues/45289

1reaction
jbrockmendelcommented, Jul 6, 2022

Looks like the fundamental problem here is that pd.Index.__sub__(ModinSeries) is not returning NotImplemented. The reversed op df["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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found