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

Fix binary operations Index by Series. #2046

Merged
merged 2 commits into from
Feb 9, 2021
Merged

Conversation

ueshin
Copy link
Collaborator

@ueshin ueshin commented Feb 8, 2021

The binary operations between Index and Series raise an error when the operations are on Index and Series in this order and the Series has no name.

>>> ks.Index([1, 2, 3]) + ks.Series([10, 20, 30])
Traceback (most recent call last):
...
TypeError: object of type 'NoneType' has no len()

>>> ks.Index([1, 2, 3]) - ks.Series([10, 20, 30])
Traceback (most recent call last):
...
TypeError: object of type 'NoneType' has no len()

>>> ks.Index([1, 2, 3]) / ks.Series([10, 20, 30])
Traceback (most recent call last):
...
TypeError: object of type 'NoneType' has no len()

>>> ks.Index([1, 2, 3]) * ks.Series([10, 20, 30])
Traceback (most recent call last):
...
TypeError: object of type 'NoneType' has no len()

Resolves #2045.

@codecov-io
Copy link

codecov-io commented Feb 8, 2021

Codecov Report

Merging #2046 (3687b30) into master (dca91a4) will decrease coverage by 2.42%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2046      +/-   ##
==========================================
- Coverage   94.71%   92.29%   -2.43%     
==========================================
  Files          54       54              
  Lines       11497    11388     -109     
==========================================
- Hits        10889    10510     -379     
- Misses        608      878     +270     
Impacted Files Coverage Δ
databricks/koalas/base.py 97.24% <100.00%> (-0.02%) ⬇️
databricks/koalas/plot/plotly.py 9.47% <0.00%> (-87.37%) ⬇️
...bricks/koalas/tests/plot/test_frame_plot_plotly.py 23.33% <0.00%> (-76.67%) ⬇️
...ricks/koalas/tests/plot/test_series_plot_plotly.py 26.92% <0.00%> (-71.26%) ⬇️
databricks/koalas/__init__.py 85.33% <0.00%> (-6.67%) ⬇️
databricks/koalas/plot/core.py 91.49% <0.00%> (-2.28%) ⬇️
databricks/conftest.py 98.30% <0.00%> (-1.70%) ⬇️
databricks/koalas/testing/utils.py 80.00% <0.00%> (-1.32%) ⬇️
databricks/koalas/generic.py 92.07% <0.00%> (-1.18%) ⬇️
databricks/koalas/indexes/multi.py 95.37% <0.00%> (-0.44%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dca91a4...3687b30. Read the comment docs.

Copy link
Contributor

@itholic itholic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! LGTM.

@itholic
Copy link
Contributor

itholic commented Feb 9, 2021

FYI: after merging this, I'm going to create a PR for supporting binary operations with list-like Python objects we discussed in #2022 (comment) !

@ueshin
Copy link
Collaborator Author

ueshin commented Feb 9, 2021

Thanks! merging.

@ueshin ueshin merged commit e6a9628 into databricks:master Feb 9, 2021
@ueshin ueshin deleted the bin_ops branch February 9, 2021 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot binary operations Index by Series.
3 participants