Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Commit 3394b06

Browse files
ongmingyanggatorsmile
authored andcommitted
[MINOR][DOCS] Docs in DataFrameNaFunctions.scala use wrong method
## What changes were proposed in this pull request? * Following the first few examples in this file, the remaining methods should also be methods of `df.na` not `df`. * Filled in some missing parentheses ## How was this patch tested? N/A Author: Ong Ming Yang <[email protected]> Closes apache#18398 from ongmingyang/master. (cherry picked from commit 4cc6295) Signed-off-by: Xiao Li <[email protected]>
1 parent f160267 commit 3394b06

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

sql/core/src/main/scala/org/apache/spark/sql/DataFrameNaFunctions.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
244244
* import com.google.common.collect.ImmutableMap;
245245
*
246246
* // Replaces all occurrences of 1.0 with 2.0 in column "height".
247-
* df.replace("height", ImmutableMap.of(1.0, 2.0));
247+
* df.na.replace("height", ImmutableMap.of(1.0, 2.0));
248248
*
249249
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "name".
250-
* df.replace("name", ImmutableMap.of("UNKNOWN", "unnamed"));
250+
* df.na.replace("name", ImmutableMap.of("UNKNOWN", "unnamed"));
251251
*
252252
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in all string columns.
253-
* df.replace("*", ImmutableMap.of("UNKNOWN", "unnamed"));
253+
* df.na.replace("*", ImmutableMap.of("UNKNOWN", "unnamed"));
254254
* }}}
255255
*
256256
* @param col name of the column to apply the value replacement
@@ -271,10 +271,10 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
271271
* import com.google.common.collect.ImmutableMap;
272272
*
273273
* // Replaces all occurrences of 1.0 with 2.0 in column "height" and "weight".
274-
* df.replace(new String[] {"height", "weight"}, ImmutableMap.of(1.0, 2.0));
274+
* df.na.replace(new String[] {"height", "weight"}, ImmutableMap.of(1.0, 2.0));
275275
*
276276
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "firstname" and "lastname".
277-
* df.replace(new String[] {"firstname", "lastname"}, ImmutableMap.of("UNKNOWN", "unnamed"));
277+
* df.na.replace(new String[] {"firstname", "lastname"}, ImmutableMap.of("UNKNOWN", "unnamed"));
278278
* }}}
279279
*
280280
* @param cols list of columns to apply the value replacement
@@ -295,13 +295,13 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
295295
*
296296
* {{{
297297
* // Replaces all occurrences of 1.0 with 2.0 in column "height".
298-
* df.replace("height", Map(1.0 -> 2.0))
298+
* df.na.replace("height", Map(1.0 -> 2.0));
299299
*
300300
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "name".
301-
* df.replace("name", Map("UNKNOWN" -> "unnamed")
301+
* df.na.replace("name", Map("UNKNOWN" -> "unnamed"));
302302
*
303303
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in all string columns.
304-
* df.replace("*", Map("UNKNOWN" -> "unnamed")
304+
* df.na.replace("*", Map("UNKNOWN" -> "unnamed"));
305305
* }}}
306306
*
307307
* @param col name of the column to apply the value replacement
@@ -324,10 +324,10 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
324324
*
325325
* {{{
326326
* // Replaces all occurrences of 1.0 with 2.0 in column "height" and "weight".
327-
* df.replace("height" :: "weight" :: Nil, Map(1.0 -> 2.0));
327+
* df.na.replace("height" :: "weight" :: Nil, Map(1.0 -> 2.0));
328328
*
329329
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "firstname" and "lastname".
330-
* df.replace("firstname" :: "lastname" :: Nil, Map("UNKNOWN" -> "unnamed");
330+
* df.na.replace("firstname" :: "lastname" :: Nil, Map("UNKNOWN" -> "unnamed"));
331331
* }}}
332332
*
333333
* @param cols list of columns to apply the value replacement

0 commit comments

Comments
 (0)