Skip to content

Commit

Permalink
[MINOR][DOCS] Docs in DataFrameNaFunctions.scala use wrong method
Browse files Browse the repository at this point in the history
## 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 <me@ongmingyang.com>

Closes #18398 from ongmingyang/master.
  • Loading branch information
ongmingyang authored and gatorsmile committed Jun 23, 2017
1 parent 2ebd083 commit 4cc6295
Showing 1 changed file with 10 additions and 10 deletions.
Expand Up @@ -268,13 +268,13 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
* import com.google.common.collect.ImmutableMap;
*
* // Replaces all occurrences of 1.0 with 2.0 in column "height".
* df.replace("height", ImmutableMap.of(1.0, 2.0));
* df.na.replace("height", ImmutableMap.of(1.0, 2.0));
*
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "name".
* df.replace("name", ImmutableMap.of("UNKNOWN", "unnamed"));
* df.na.replace("name", ImmutableMap.of("UNKNOWN", "unnamed"));
*
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in all string columns.
* df.replace("*", ImmutableMap.of("UNKNOWN", "unnamed"));
* df.na.replace("*", ImmutableMap.of("UNKNOWN", "unnamed"));
* }}}
*
* @param col name of the column to apply the value replacement
Expand All @@ -295,10 +295,10 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
* import com.google.common.collect.ImmutableMap;
*
* // Replaces all occurrences of 1.0 with 2.0 in column "height" and "weight".
* df.replace(new String[] {"height", "weight"}, ImmutableMap.of(1.0, 2.0));
* df.na.replace(new String[] {"height", "weight"}, ImmutableMap.of(1.0, 2.0));
*
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "firstname" and "lastname".
* df.replace(new String[] {"firstname", "lastname"}, ImmutableMap.of("UNKNOWN", "unnamed"));
* df.na.replace(new String[] {"firstname", "lastname"}, ImmutableMap.of("UNKNOWN", "unnamed"));
* }}}
*
* @param cols list of columns to apply the value replacement
Expand All @@ -319,13 +319,13 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
*
* {{{
* // Replaces all occurrences of 1.0 with 2.0 in column "height".
* df.replace("height", Map(1.0 -> 2.0))
* df.na.replace("height", Map(1.0 -> 2.0));
*
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "name".
* df.replace("name", Map("UNKNOWN" -> "unnamed")
* df.na.replace("name", Map("UNKNOWN" -> "unnamed"));
*
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in all string columns.
* df.replace("*", Map("UNKNOWN" -> "unnamed")
* df.na.replace("*", Map("UNKNOWN" -> "unnamed"));
* }}}
*
* @param col name of the column to apply the value replacement
Expand All @@ -348,10 +348,10 @@ final class DataFrameNaFunctions private[sql](df: DataFrame) {
*
* {{{
* // Replaces all occurrences of 1.0 with 2.0 in column "height" and "weight".
* df.replace("height" :: "weight" :: Nil, Map(1.0 -> 2.0));
* df.na.replace("height" :: "weight" :: Nil, Map(1.0 -> 2.0));
*
* // Replaces all occurrences of "UNKNOWN" with "unnamed" in column "firstname" and "lastname".
* df.replace("firstname" :: "lastname" :: Nil, Map("UNKNOWN" -> "unnamed");
* df.na.replace("firstname" :: "lastname" :: Nil, Map("UNKNOWN" -> "unnamed"));
* }}}
*
* @param cols list of columns to apply the value replacement
Expand Down

0 comments on commit 4cc6295

Please sign in to comment.