Repository: spark Updated Branches: refs/heads/master 1a54f48b6 -> b6f837c9d
[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 <djmggue...@gmail.com> Closes #20775 from DylanGuedes/input_variable. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/b6f837c9 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/b6f837c9 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/b6f837c9 Branch: refs/heads/master Commit: b6f837c9d3cb0f76f0a52df37e34aea8944f6867 Parents: 1a54f48 Author: DylanGuedes <djmggue...@gmail.com> Authored: Sat Mar 10 19:48:29 2018 +0900 Committer: hyukjinkwon <gurwls...@gmail.com> Committed: Sat Mar 10 19:48:29 2018 +0900 ---------------------------------------------------------------------- examples/src/main/python/ml/dataframe_example.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/b6f837c9/examples/src/main/python/ml/dataframe_example.py ---------------------------------------------------------------------- diff --git a/examples/src/main/python/ml/dataframe_example.py b/examples/src/main/python/ml/dataframe_example.py index d62cf23..cabc3de 100644 --- a/examples/src/main/python/ml/dataframe_example.py +++ b/examples/src/main/python/ml/dataframe_example.py @@ -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 " + --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org