0
4

1 回答 1

1

解决此问题的一种最简单方法是,当您将 pandas 框架转换为 H2OFrame 时,使用参数column_types,如下所示:

In [69]: col_types
Out[69]: ['categorical', 'categorical', 'categorical', 'categorical']

In [70]: h2o_frame = h2o.H2OFrame(df,column_types=col_types);h2o_frame ;h2o_frame.types ;h2o_frame
Parse progress: |█████████████████████████████████████████████████████████████████████████████| 100%
Out[70]: 
datetime             month    time      weekend
-------------------  -------  --------  ---------
2016-12-17 00:00:00  月       00:00:30  周六

[1 row x 4 columns]


In [71]: dff = h2o_frame.as_data_frame();dff
Out[71]: 
              datetime month      time weekend
0  2016-12-17 00:00:00     月  00:00:30      周六

希望对你有帮助..!!

干杯..!!

于 2018-06-05T10:26:37.207 回答