Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

H2O Python - how to get variable types, getTypes equivalent

Tags:

python

h2o

What is the Python equivalent of getTypes in R? I'm trying to extract the variable types for each column from H2O data frame (enum, string, int etc.)

Also, broadly can someone send me a link to some documentation listing all the properties and functions for data frames for Python? Things like. df.nrow, df.shape etc. I have really hard time finding such clear source.

like image 685
thasainta Avatar asked Apr 21 '17 17:04

thasainta


People also ask

How to find the data type of a variable in Python?

Similarly, different types of variables are used in Python to store different values. The built-in function ‘type ()’ can be used to find the data type of a variable. We can also use isinstance () to check if the value is of the specified data type or not.

What is H2O in Python?

H2O from Python is a tool for rapidly turning over models, doing data munging, and building applications in a fast, scalable environment without any of the mental anguish about parallelism and distribution of work. What is H2O? H2O is a Java-based software for data modeling and general computing.

What are the built-in data types in Python?

Built-in Data Types. In programming, data type is an important concept. Variables can store data of different types, and different types can do different things. Python has the following data types built-in by default, in these categories: Text Type: str. Numeric Types: int, float , complex. Sequence Types:

What is the difference between classification and regression in H2O?

H2O algorithms will treat a problem as a classification problem if the column type is factor and a regression problem if the column type is numeric. You can force H2O to use either classification or regression by changing the column type.


1 Answers

You can get the documentation for H2O's Python API (specifically for H2OFrame methods) here: http://docs.h2o.ai/h2o/latest-stable/h2o-py/docs/frame.html

If you want to get the types of a dataframe in H2O Python do .types

frame = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/iris/iris.csv")
frame.types
{u'C3': u'real', u'C2': u'real', u'C1': u'real', u'C5': u'enum', u'C4': u'real'}
like image 73
Lauren Avatar answered Nov 03 '22 01:11

Lauren