JaredDudley04
JaredDudley04

Reputation: 123

is there a way to convert h2oframe to pandas dataframe

I am able to convert dataframe to h2oframe but how can I convert back to a dataframe? If this is possible not can I convert it to a python list?

import pandas as pd
import h2o
df = pd.DataFrame({'1': [2838, 3222, 4576, 5665, 5998], '2': [1123, 3228, 3587, 5678, 6431]})
data = h2o.H2OFrame(df)

Upvotes: 12

Views: 17432

Answers (2)

Erin LeDell
Erin LeDell

Reputation: 8819

There is an H2OFrame method called as_data_frame() but h2o.as_list() also works.

data_as_df = data.as_data_frame()

Upvotes: 26

nautograph
nautograph

Reputation: 274

Convert h2o frame to List

data_as_list = h2o.as_list(data, use_pandas=False)

Convert h2o frame to pandas DataFrame. (Default use_pandas=True)

data_as_df = h2o.as_list(data)

Upvotes: 11

Related Questions