Skip to content

Commit

Permalink
[SPARK-39030][PYTHON] Rename sum to avoid shading the builtin Python …
Browse files Browse the repository at this point in the history
…function

### What changes were proposed in this pull request?
Rename sum to something else.

### Why are the changes needed?
Sum is a build in function in python. [SUM() at python docs](https://docs.python.org/3/library/functions.html#sum)

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
Use existing tests.

Closes apache#36364 from bjornjorgensen/rename-sum.

Authored-by: bjornjorgensen <bjornjorgensen@gmail.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit 3821d80)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
bjornjorgensen authored and HyukjinKwon committed Apr 27, 2022
1 parent 93289a5 commit d790347
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/pyspark/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,8 +1326,8 @@ def value_counts(
sdf = sdf.orderBy(F.col("count").desc())

if normalize:
sum = sdf_dropna.count()
sdf = sdf.withColumn("count", F.col("count") / SF.lit(sum))
drop_sum = sdf_dropna.count()
sdf = sdf.withColumn("count", F.col("count") / SF.lit(drop_sum))

internal = InternalFrame(
spark_frame=sdf,
Expand Down

0 comments on commit d790347

Please sign in to comment.