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

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


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

commit d79034737977ab658b4bd7dcd1f36b2367959993
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 bdec3ac3f46..bd1d13ce200 100644
--- a/python/pyspark/pandas/base.py
+++ b/python/pyspark/pandas/base.py
@@ -1326,8 +1326,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