koalas icon indicating copy to clipboard operation
koalas copied to clipboard

Enabling binary operations with list-like Python objects.

Open itholic opened this issue 4 years ago • 2 comments

So far, Koalas doesn't support list-like Python objects for Series binary operations.

>>> kser
0    1
1    2
2    3
3    4
4    5
5    6
Name: x, dtype: int64

>>> kser + [10, 20, 30, 40, 50, 60]
Traceback (most recent call last):
...

This PR enables it.

>>> kser
0    1
1    2
2    3
3    4
4    5
5    6
Name: x, dtype: int64
>>> kser + [10, 20, 30, 40, 50, 60]
0    11
1    22
2    33
3    44
4    55
5    66
Name: x, dtype: int64
>>> kser - [10, 20, 30, 40, 50, 60]
0    -9
1   -18
2   -27
3   -36
4   -45
5   -54
Name: x, dtype: int64
>>> kser * [10, 20, 30, 40, 50, 60]
0     10
1     40
2     90
3    160
4    250
5    360
Name: x, dtype: int64
>>> kser / [10, 20, 30, 40, 50, 60]
0    0.1
1    0.1
2    0.1
3    0.1
4    0.1
5    0.1
Name: x, dtype: float64

ref https://github.com/databricks/koalas/pull/2022#issuecomment-768011750

itholic avatar Feb 15 '21 07:02 itholic

Codecov Report

Merging #2054 (0fd3666) into master (87f5b18) will decrease coverage by 1.44%. The diff coverage is 91.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2054      +/-   ##
==========================================
- Coverage   94.71%   93.26%   -1.45%     
==========================================
  Files          54       54              
  Lines       11503    11735     +232     
==========================================
+ Hits        10895    10945      +50     
- Misses        608      790     +182     
Impacted Files Coverage Δ
databricks/koalas/utils.py 93.66% <75.00%> (-1.71%) :arrow_down:
databricks/koalas/base.py 97.35% <96.00%> (+0.06%) :arrow_up:
databricks/koalas/indexes/base.py 97.43% <100.00%> (ø)
databricks/koalas/usage_logging/__init__.py 26.66% <0.00%> (-65.84%) :arrow_down:
databricks/koalas/usage_logging/usage_logger.py 47.82% <0.00%> (-52.18%) :arrow_down:
databricks/koalas/__init__.py 80.00% <0.00%> (-12.00%) :arrow_down:
databricks/conftest.py 91.30% <0.00%> (-8.70%) :arrow_down:
databricks/koalas/accessors.py 86.43% <0.00%> (-7.04%) :arrow_down:
databricks/koalas/spark/accessors.py 88.67% <0.00%> (-6.29%) :arrow_down:
databricks/koalas/typedef/typehints.py 91.06% <0.00%> (-2.75%) :arrow_down:
... and 13 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 87f5b18...0fd3666. Read the comment docs.

codecov-io avatar Feb 18 '21 07:02 codecov-io

https://issues.apache.org/jira/browse/SPARK-36437

xinrong-meng avatar Aug 05 '21 21:08 xinrong-meng