Filtering H2O data frame on multiple fields of date and int type

Lets create an H2O frame using h2o.create_frame API:

df = h2o.create_frame(time_fraction = .1,rows=10, cols = 10)

Above will create a frame of 10 rows and 10 columns and based on time_fraction values 0.1 (1 out of 10 provided columns) will be date/time columns. The data frame looks as below:

Screen Shot 2017-04-27 at 1.20.12 PM

Here are few example filtering scripts:

df1 = df[ (df['C4'] > 0) & (df['C7'] < 10)]
df2 = df[ (df['C4'] > 0) & (df['C7'] < 10)   & (df['C9'] > datetime.datetime(2000,1,1))  ]
df2 = df[ ((df['C4'] > 0) | (df['C7'] < 10)) & (df['C9'] > datetime.datetime(2000,1,1)) ]

and the screenshot:

Screen Shot 2017-04-27 at 1.19.09 PM

Thats it, enjoy!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s