简体   繁体   中英

How to select rows from a python H2O data frame based on column values?

How can I subset a h2o frame in python based on a list, rather than a single value ? For example, in R one would use %in% , or in panda I can see one can use .isin() . I'd like to do something like this, if it makes sense:

df.loc[df['column name'].isin(pickTheseValues)]

How does it work in h2o? Alternatively, can I cast the h2o data frame into panda and do the operation as above?

h2o provides slicing rows on dataframe for both R and Python so you can use isin method to filter rows based on a column.

mask = df["column name"].isin(pickTheseValues)
cols = df[mask,:]

You can reach the details by this link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM