In [1]:
#----------------------------------------------------------------------
# Try to slice by using != factor_level
#----------------------------------------------------------------------
In [2]:
import h2o
In [3]:
h2o.init()
In [4]:
from h2o.utils.shared_utils import _locate # private function. used to find files within h2o git project directory.
air = h2o.import_file(path=_locate("smalldata/airlines/allyears2k_headers.zip"))
In [5]:
rows, cols = air.dim
print([rows, cols])
In [6]:
#
# Select all flights not departing from SFO
#
not_sfo = air[air["Origin"] != "SFO"]
sfo = air[air["Origin"] == "SFO"]
no_rows, no_cols = not_sfo.dim
yes_rows, yes_cols = sfo.dim
print("no_rows: {0}".format(no_rows))
print("yes_rows: {0}".format(yes_rows))
print("no_cols: {0}".format(no_cols))
print("yes_cols: {0}".format(yes_cols))