Skip to content
Snippets Groups Projects
Commit 91a577d2 authored by Yuhao Yang's avatar Yuhao Yang Committed by Xiangrui Meng
Browse files

[SPARK-10249] [ML] [DOC] Add Python Code Example to StopWordsRemover User Guide

jira: https://issues.apache.org/jira/browse/SPARK-10249

update user guide since python support added.

Author: Yuhao Yang <hhbyyh@gmail.com>

Closes #8620 from hhbyyh/swPyDocExample.
parent 2f6fd525
No related branches found
No related tags found
No related merge requests found
...@@ -512,6 +512,25 @@ DataFrame dataset = jsql.createDataFrame(rdd, schema); ...@@ -512,6 +512,25 @@ DataFrame dataset = jsql.createDataFrame(rdd, schema);
remover.transform(dataset).show(); remover.transform(dataset).show();
{% endhighlight %} {% endhighlight %}
</div> </div>
<div data-lang="python" markdown="1">
[`StopWordsRemover`](api/python/pyspark.ml.html#pyspark.ml.feature.StopWordsRemover)
takes an input column name, an output column name, a list of stop words,
and a boolean indicating if the matches should be case sensitive (false
by default).
{% highlight python %}
from pyspark.ml.feature import StopWordsRemover
sentenceData = sqlContext.createDataFrame([
(0, ["I", "saw", "the", "red", "baloon"]),
(1, ["Mary", "had", "a", "little", "lamb"])
], ["label", "raw"])
remover = StopWordsRemover(inputCol="raw", outputCol="filtered")
remover.transform(sentenceData).show(truncate=False)
{% endhighlight %}
</div>
</div> </div>
## $n$-gram ## $n$-gram
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment