[PYTHON] Changes input variable to not conflict with built-in function

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.
This commit is contained in:
DylanGuedes 2018-03-10 19:48:29 +09:00 committed by hyukjinkwon
parent 1a54f48b67
commit b6f837c9d3

View file

@ -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
@ -35,18 +35,18 @@ if __name__ == "__main__":
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 " +