code: def from_data_frame(df, categorical=False, nb_classes=None):
      """Convert DataFrame back to pair of numpy arrays"""
      lp_rdd = df.rdd.map(
          lambda row: LabeledPoint(row.label, row.features)
      )
      features, labels = from_labeled_point(
          lp_rdd, categorical, nb_classes
      )
      return features, labels
  
imports: from pyspark.sql import SQLContext
  from pyspark.mllib.regression import LabeledPoint
  from ..utils.rdd_utils import from_labeled_point, to_labeled_point, lp_to_simple_rdd
  from pyspark.mllib.linalg import Vector, Vectors
label_desc: Use image node_id 2 for calling a global function with example usage: from_data_frame(df, categorical, nb_classes) and returns: features,  labels