Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20499#discussion_r165884365
  
    --- Diff: python/pyspark/sql/dataframe.py ---
    @@ -1587,6 +1600,52 @@ def replace(self, to_replace, value=None, 
subset=None):
             |null|  null|null|
             +----+------+----+
             """
    +
    +        # It deals with a problem when 'value' is set to None and 
'to_replace' is a dictionary.
    +        # Validate if arguments are missing or not.
    +        is_more_than_two = len(args) + len(kwargs) > 2
    +        if is_more_than_two:
    +            raise TypeError(
    +                "The number of arguments should not be more than 3; 
however, got "
    +                "%s arguments." % len([to_replace] + list(args) + 
list(kwargs.values())))
    +
    +        is_unexpected_kwargs = \
    +            len(kwargs) == 2 and ("value" not in kwargs or "subset" not in 
kwargs)
    --- End diff --
    
    ```python
    df.na.replace({'Alice': 'Bob'}, foo = 'bar').show()
    ```
    
    Seems this case can't be detected?
    
    
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to