Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Arithmetic cannot process period type #2370

Closed
qinxuye opened this issue Aug 23, 2021 · 0 comments · Fixed by #2373
Closed

[BUG] Arithmetic cannot process period type #2370

qinxuye opened this issue Aug 23, 2021 · 0 comments · Fixed by #2373
Labels
mod: dataframe type: bug Something isn't working
Milestone

Comments

@qinxuye
Copy link
Collaborator

qinxuye commented Aug 23, 2021

Describe the bug

Arithmetic cannot process period type.

To Reproduce
To help us reproducing this bug, please provide information below:

  1. Your Python version
  2. The version of Mars you use
  3. Versions of crucial packages, such as numpy, scipy and pandas
  4. Full stack of the error.
  5. Minimized code to reproduce the error.
In [1]: import pandas as pd                                                                                                                                                                                 

In [2]: import mars.dataframe as md                                                                                                                                                                         

In [3]: s = md.Series(pd.period_range("2000-01-01", periods=10, freq="D"))                                                                                                                                  

In [4]: left, right = s[2], s[7]                                                                                                                                                                            

In [6]: ((s >= left) & (s <= right)).execute()                                                                                                                                                              
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-a4d787f38c66> in <module>
----> 1 ((s >= left) & (s <= right)).execute()

~/Workspace/mars/mars/dataframe/arithmetic/__init__.py in call(df, other, **kw)
     89                     raise ValueError('Can only compare '
     90                                      'identically-labeled DataFrame object')
---> 91         return wrap_notimplemented_exception(func)(df, other, **kw)
     92     return call
     93 

~/Workspace/mars/mars/dataframe/utils.py in wrapper(*args, **kwargs)
    844     def wrapper(*args, **kwargs):
    845         try:
--> 846             return func(*args, **kwargs)
    847         except NotImplementedError:
    848             return NotImplemented

~/Workspace/mars/mars/dataframe/arithmetic/greater_equal.py in ge(df, other, axis, level)
     50 def ge(df, other, axis='columns', level=None):
     51     op = DataFrameGreaterEqual(axis=axis, level=level, lhs=df, rhs=other)
---> 52     return op(df, other)

~/Workspace/mars/mars/dataframe/arithmetic/core.py in __call__(self, x1, x2)
    486     def __call__(self, x1, x2):
    487         x1 = self._process_input(x1)
--> 488         x2 = self._process_input(x2)
    489         if isinstance(x1, SERIES_TYPE) and isinstance(x2, DATAFRAME_TYPE):
    490             # reject invoking series's op on dataframe

~/Workspace/mars/mars/dataframe/arithmetic/core.py in _process_input(x)
    437             return DataFrame(x)
    438         elif isinstance(x, (list, tuple, np.ndarray, TENSOR_TYPE)):
--> 439             return astensor(x)
    440         raise NotImplementedError
    441 

~/Workspace/mars/mars/tensor/datasource/array.py in tensor(data, dtype, order, chunk_size, gpu, sparse)
    132         if isinstance(data, TensorData):
    133             data = Tensor(data)
--> 134         return data.astype(dtype or data.dtype, order=order, copy=False)
    135     elif isinstance(data, (tuple, list)) and len(data) > 0 and \
    136             all(isinstance(d, TENSOR_TYPE) for d in data):

~/Workspace/mars/mars/tensor/base/astype.py in _astype(tensor, dtype, order, casting, copy)
    151     array([1, 2, 2])
    152     """
--> 153     dtype = np.dtype(dtype)
    154     tensor_order = get_order(order, tensor.order)
    155 

TypeError: Cannot interpret 'period[D]' as a data type
@qinxuye qinxuye added type: bug Something isn't working mod: dataframe labels Aug 23, 2021
@qinxuye qinxuye added this to the v0.8.0a2 milestone Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: dataframe type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant