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

Add Support for Chained Arithmetics #69

Closed
blaklaybul opened this issue Nov 26, 2019 · 3 comments
Closed

Add Support for Chained Arithmetics #69

blaklaybul opened this issue Nov 26, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request topic:series Issue or PR about eland.Series

Comments

@blaklaybul
Copy link
Contributor

We currently only support arithmetics with 2 operands, i.e. the following throw an exception:

df['total_quantity'] * df['taxful_total_price'] * 0.65
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/michael/projects/eland/eland/series.py", line 678, in __mul__
    return self._numeric_op(right, _get_method_name())
  File "/Users/michael/projects/eland/eland/series.py", line 1039, in _numeric_op
    elif np.issubdtype(np.dtype(type(right)), np.number) and np.issubdtype(self._dtype, np.number):
  File "/Users/michael/projects/eland/eland/series.py", line 368, in _dtype
    return self._query_compiler.dtypes[0]
  File "/Users/michael/projects/eland/eland/query_compiler.py", line 104, in dtypes
    return self._mappings.dtypes(columns)
  File "/Users/michael/projects/eland/eland/mappings.py", line 501, in dtypes
    {key: np.dtype(self._source_field_pd_dtypes[key]) for key in field_names})
  File "/Users/michael/projects/eland/eland/mappings.py", line 501, in <dictcomp>
    {key: np.dtype(self._source_field_pd_dtypes[key]) for key in field_names})
KeyError: 'total_quantity___mul___taxful_total_price'
>>> df['customer_last_name'] + "," + df['customer_first_name']
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/michael/projects/eland/eland/series.py", line 521, in __add__
    return self._numeric_op(right, _get_method_name())
  File "/Users/michael/projects/eland/eland/series.py", line 1014, in _numeric_op
    if (np.issubdtype(self._dtype, np.number) and np.issubdtype(right._dtype, np.number)):
  File "/Users/michael/projects/eland/eland/series.py", line 368, in _dtype
    return self._query_compiler.dtypes[0]
  File "/Users/michael/projects/eland/eland/query_compiler.py", line 104, in dtypes
    return self._mappings.dtypes(columns)
  File "/Users/michael/projects/eland/eland/mappings.py", line 501, in dtypes
    {key: np.dtype(self._source_field_pd_dtypes[key]) for key in field_names})
  File "/Users/michael/projects/eland/eland/mappings.py", line 501, in <dictcomp>
    {key: np.dtype(self._source_field_pd_dtypes[key]) for key in field_names})
KeyError: 'customer_last_name___add___,||str'

I think this is because of the way that we create intermediary field names to store the scripted fields. We'll need logic to understand that the latter operations rely on the first and make the appropriate field names available to subsequent ops.

@blaklaybul blaklaybul added topic:series Issue or PR about eland.Series enhancement New feature or request labels Nov 26, 2019
@stevedodson stevedodson self-assigned this Nov 26, 2019
@stevedodson
Copy link
Contributor

Similarly aggs on chained series doesn't work.

@blaklaybul blaklaybul changed the title Add Support Chained Arithmetics Add Support for Chained Arithmetics Nov 26, 2019
@stevedodson
Copy link
Contributor

Still moving this forward

@stevedodson
Copy link
Contributor

Should be addressed by #103

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic:series Issue or PR about eland.Series
Projects
None yet
Development

No branches or pull requests

2 participants