Description

Transform vector to table columns. this class maps vector column to many columns.

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="stream")
  10. VectorToColumnsStreamOp().setSelectedCol("vec").setOutputCols(["f0", "f1"]).linkFrom(data).print()
  11. StreamOperator.execute()

Result

VectorToColumns(steam) - 图1