Description

Transform vector to table columns. This transformer will map vector column to columns as designed.

Parameters

Name Description Type Required? Default Value
selectedCol Name of the selected column used for processing String
outputCols Names of the output columns String[]
reservedCols Names of the columns to be retained in the output table String[] null

Script Example

Script

  1. data = np.array([["a", "10.0, 100"],\
  2. ["b", "-2.5, 9"],\
  3. ["c", "100.2, 1"],\
  4. ["d", "-99.9, 100"],\
  5. ["a", "1.4, 1"],\
  6. ["b", "-2.2, 9"],\
  7. ["c", "100.9, 1"]])
  8. df = pd.DataFrame({"col" : data[:,0], "vec" : data[:,1]})
  9. data = dataframeToOperator(df, schemaStr="col string, vec string",op_type="batch")
  10. VectorToColumns().setSelectedCol("vec").setOutputCols(["f0", "f1"]).transform(data).collectToDataframe()

Result

VectorToColumns(batch) - 图1