Skip to content

Commit

Permalink
[PYTHON] Changes input variable to not conflict with built-in function
Browse files Browse the repository at this point in the history
Signed-off-by: DylanGuedes <djmgguedesgmail.com>

## What changes were proposed in this pull request?

Changes variable name conflict: [input is a built-in python function](https://stackoverflow.com/questions/20670732/is-input-a-keyword-in-python).

## How was this patch tested?

I runned the example and it works fine.

Author: DylanGuedes <djmgguedes@gmail.com>

Closes #20775 from DylanGuedes/input_variable.
  • Loading branch information
DylanGuedes authored and HyukjinKwon committed Mar 10, 2018
1 parent 1a54f48 commit b6f837c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/src/main/python/ml/dataframe_example.py
Expand Up @@ -17,7 +17,7 @@

"""
An example of how to use DataFrame for ML. Run with::
bin/spark-submit examples/src/main/python/ml/dataframe_example.py <input>
bin/spark-submit examples/src/main/python/ml/dataframe_example.py <input_path>
"""
from __future__ import print_function

Expand All @@ -35,18 +35,18 @@
print("Usage: dataframe_example.py <libsvm file>", file=sys.stderr)
sys.exit(-1)
elif len(sys.argv) == 2:
input = sys.argv[1]
input_path = sys.argv[1]
else:
input = "data/mllib/sample_libsvm_data.txt"
input_path = "data/mllib/sample_libsvm_data.txt"

spark = SparkSession \
.builder \
.appName("DataFrameExample") \
.getOrCreate()

# Load input data
print("Loading LIBSVM file with UDT from " + input + ".")
df = spark.read.format("libsvm").load(input).cache()
# Load an input file
print("Loading LIBSVM file with UDT from " + input_path + ".")
df = spark.read.format("libsvm").load(input_path).cache()
print("Schema from LIBSVM:")
df.printSchema()
print("Loaded training data as a DataFrame with " +
Expand Down

0 comments on commit b6f837c

Please sign in to comment.