Skip to content

Fix binary operations Index by Series.#2046

Merged
ueshin merged 2 commits into
databricks:masterfrom
ueshin:bin_ops
Feb 9, 2021
Merged

Fix binary operations Index by Series.#2046
ueshin merged 2 commits into
databricks:masterfrom
ueshin:bin_ops

Conversation

@ueshin
Copy link
Copy Markdown
Contributor

@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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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