时间转特征的代码如下,仅供参考:
/** * 时间转成特征 * @param clickTime 广告点击时间DDHHMM 011235 * @return 特征列表 */ def clickTime2features(clickTime:String): ArrayBuffer[String] = { var features = ArrayBuffer[String]() features += "day_" + clickTime.substring(0, 2) features += "hour_" + clickTime.substring(2, 4) features }