This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.3 by this push:
     new 052ae962b51 [SPARK-39030][PYTHON] Rename sum to avoid shading the 
builtin Python function
052ae962b51 is described below

commit 052ae962b5104e36af013117e13baa46202d428a
Author: bjornjorgensen <[email protected]>
AuthorDate: Wed Apr 27 10:10:11 2022 +0900

    [SPARK-39030][PYTHON] Rename sum to avoid shading the builtin Python 
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 #36364 from bjornjorgensen/rename-sum.
    
    Authored-by: bjornjorgensen <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
    (cherry picked from commit 3821d807a599a2d243465b4e443f1eb68251d432)
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 python/pyspark/pandas/base.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/pyspark/pandas/base.py b/python/pyspark/pandas/base.py
index 2d2c79e7f47..ebbaff32ee6 100644
--- a/python/pyspark/pandas/base.py
+++ b/python/pyspark/pandas/base.py
@@ -1362,8 +1362,8 @@ class IndexOpsMixin(object, metaclass=ABCMeta):
                 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,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to