[GitHub] spark pull request #18895: [SPARK-21658][SQL][PYSPARK] Add default None for ...

2017-08-14 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/18895


---
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



[GitHub] spark pull request #18895: [SPARK-21658][SQL][PYSPARK] Add default None for ...

2017-08-14 Thread byakuinss
Github user byakuinss commented on a diff in the pull request:

https://github.com/apache/spark/pull/18895#discussion_r132968529
  
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -1403,6 +1403,16 @@ def replace(self, to_replace, value=None, 
subset=None):
 |null|  null|null|
 ++--++
 
+>>> df4.na.replace('Alice').show()
+++--++
+| age|height|name|
+++--++
+|  10|80|null|
+|   5|  null| Bob|
+|null|  null| Tom|
+|null|  null|null|
+++--++ 
--- End diff --

Thanks for your reminding! I'll remove them.


---
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



[GitHub] spark pull request #18895: [SPARK-21658][SQL][PYSPARK] Add default None for ...

2017-08-14 Thread byakuinss
Github user byakuinss commented on a diff in the pull request:

https://github.com/apache/spark/pull/18895#discussion_r132968408
  
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -1837,8 +1847,8 @@ def fill(self, value, subset=None):
 
 fill.__doc__ = DataFrame.fillna.__doc__
 
-def replace(self, to_replace, value, subset=None):
-return self.df.replace(to_replace, value, subset)
+def replace(self, to_replace, value=None, subset=None):
+return self.df.replace(to_replace=to_replace, value=value, 
subset=subset)
--- End diff --

Got it, I'll change them back.


---
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



[GitHub] spark pull request #18895: [SPARK-21658][SQL][PYSPARK] Add default None for ...

2017-08-13 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/18895#discussion_r132874492
  
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -1837,8 +1847,8 @@ def fill(self, value, subset=None):
 
 fill.__doc__ = DataFrame.fillna.__doc__
 
-def replace(self, to_replace, value, subset=None):
-return self.df.replace(to_replace, value, subset)
+def replace(self, to_replace, value=None, subset=None):
+return self.df.replace(to_replace=to_replace, value=value, 
subset=subset)
--- End diff --

I think it is okay to leave this line as was.


---
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



[GitHub] spark pull request #18895: [SPARK-21658][SQL][PYSPARK] Add default None for ...

2017-08-13 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/18895#discussion_r132874471
  
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -1403,6 +1403,16 @@ def replace(self, to_replace, value=None, 
subset=None):
 |null|  null|null|
 ++--++
 
+>>> df4.na.replace('Alice').show()
+++--++
+| age|height|name|
+++--++
+|  10|80|null|
+|   5|  null| Bob|
+|null|  null| Tom|
+|null|  null|null|
+++--++ 
--- End diff --

looks trailing white spaces should be removed. Could we remove these?


---
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



[GitHub] spark pull request #18895: [SPARK-21658][SQL][PYSPARK] Add default None for ...

2017-08-09 Thread byakuinss
GitHub user byakuinss opened a pull request:

https://github.com/apache/spark/pull/18895

[SPARK-21658][SQL][PYSPARK] Add default None for value in na.replace in 
PySpark

## What changes were proposed in this pull request?
JIRA issue: https://issues.apache.org/jira/browse/SPARK-21658

Add default None for value in `na.replace` since `Dataframe.replace` and 
`DataframeNaFunctions.replace` are alias. 

The default values are the same now. 
```
>>> df = sqlContext.createDataFrame([('Alice', 10, 80.0)])
>>> df.replace({"Alice": "a"}).first()
Row(_1=u'a', _2=10, _3=80.0)
>>> df.na.replace({"Alice": "a"}).first()
Row(_1=u'a', _2=10, _3=80.0)
```

## How was this patch tested?
Existing tests.

cc @viirya 


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/byakuinss/spark SPARK-21658

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/18895.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #18895


commit 8af1e15f37c750dda53542b5a854f832ff006773
Author: byakuinss 
Date:   2017-08-09T16:39:07Z

[SPARK-21658][SQL][PYSPARK] Add default None for value in na.replace




---
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