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

    https://github.com/apache/spark/pull/18820#discussion_r131569456
  
    --- Diff: python/pyspark/sql/dataframe.py ---
    @@ -1393,6 +1393,16 @@ def replace(self, to_replace, value=None, 
subset=None):
             |null|  null| null|
             +----+------+-----+
     
    +        >>> df4.na.replace('Alice', None).show()
    --- End diff --
    
    I guess it is `.na.replace` vs `.replace`. I think both should be the same 
though. I just built against this PR and double checked as below:
    
    ```python
    >>> df = spark.createDataFrame([('Alice', 10, 80.0)]).replace("Alice")
    ```
    ```python
    >>> df.replace("Alice").first()
    ```
    ```
    Row(_1=None, _2=10, _3=80.0)
    ```
    ```python
    >>> df.na.replace("Alice").first()
    ```
    
    ```
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: replace() takes at least 3 arguments (2 given)
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to