scalah2osparkling-water

How change the column type numeric to enum in sparkling water using scala?


I have to change numeric columns to Enum type of h2o frame in sparkling water using Scala and how to print schema of h2o frame.


Solution

  • We have to transform our H2OFrame.

    Here is an example:

    NameOfH2OFrame.colToEnum(Array(<"NameOfColumnYouWantToChangeInEnum">))
    
    val h2oFrameTrain = h2oContext.asH2OFrame(trainingData)
    h2oFrameTrain.colToEnum(Array("WEEKDAY_LABEL", "EVENT_TYPE", "EVENT_NAME"))