Access element of a vector in a Spark DataFrame (Logistic Regression probability vector) [duplicate]
问题 This question already has answers here : How to access element of a VectorUDT column in a Spark DataFrame? (2 answers) Closed 2 years ago . I trained a LogisticRegression model in PySpark (ML package) and the result of the prediction is a PySpark DataFrame ( cv_predictions ) (see [1]). The probability column (see [2]) is a vector type (see [3]). [1] type(cv_predictions_prod) pyspark.sql.dataframe.DataFrame [2] cv_predictions_prod.select('probability').show(10, False) +------------------------