FloatColumn

class getml.data.columns.FloatColumn(name='', role='numerical', num=0, df_name='')[source]

Handler for numerical data in the engine.

This is a handler for all numerical data in the getML engine, including time stamps.

Args:

name (str, optional): Name of the categorical column. role (str, optional): Role that the column plays. num (int, optional): Number of the column. df_name (str, optional):

name instance variable of the DataFrame containing this column.

Examples:

import numpy as np

import getml.data as data
import getml.engine as engine
import getml.data.roles as roles

# ----------------

engine.set_project("examples")

# ----------------
# Create a data frame from a JSON string

json_str = """{
    "names": ["patrick", "alex", "phil", "ulrike"],
    "column_01": [2.4, 3.0, 1.2, 1.4],
    "join_key": ["0", "1", "2", "3"],
    "time_stamp": ["2019-01-01", "2019-01-02", "2019-01-03", "2019-01-04"]
}"""

my_df = data.DataFrame(
    "MY DF",
    roles={
        "unused_string": ["names", "join_key", "time_stamp"],
        "unused_float": ["column_01"]}
).read_json(
    json_str
)

# ----------------

col1 = my_df["column_01"]

# ----------------

col2 = 2.0 - col1

my_df.add(col2, "name", roles.numerical)

# ----------------
# If you do not explicitly set a role,
# the assigned role will either be
# roles.unused_float.

col3 = (col1 + 2.0*col2) / 3.0

my_df["column_03"] = col3
my_df.set_role("column_03", roles.numerical)

Methods

abs()

Compute absolute value.

acos()

Compute arc cosine.

alias(alias)

Adds an alias to the column.

as_str()

Transforms column to a string.

asin()

Compute arc sine.

assert_equal([alias])

ASSERT EQUAL aggregation.

atan()

Compute arc tangent.

avg([alias])

AVG aggregation.

cbrt()

Compute cube root.

ceil()

Round up value.

cos()

Compute cosine.

count([alias])

COUNT aggregation.

day()

Extract day (of the month) from a time stamp.

erf()

Compute error function.

exp()

Compute exponential function.

floor()

Round down value.

gamma()

Compute gamma function.

hour()

Extract hour (of the day) from a time stamp.

is_inf()

Determine whether the value is infinite.

is_nan()

Determine whether the value is nan.

is_null()

Determine whether the value is nan.

lgamma()

Compute log-gamma function.

log()

Compute natural logarithm.

max([alias])

MAX aggregation.

median([alias])

MEDIAN aggregation.

min([alias])

MIN aggregation.

minute()

Extract minute (of the hour) from a time stamp.

month()

Extract month from a time stamp.

round()

Round to nearest.

second()

Extract second (of the minute) from a time stamp.

sin()

Compute sine.

sqrt()

Compute square root.

stddev([alias])

STDDEV aggregation.

sum([alias])

SUM aggregation.

tan()

Compute tangent.

to_numpy([sock])

Transform column to numpy array

update(condition, values)

Returns an updated version of this column.

var([alias])

VAR aggregation.

weekday()

Extract day of the week from a time stamp, Sunday being 0.

year()

Extract year from a time stamp.

yearday()

Extract day of the year from a time stamp.

Attributes

length

The length of the column (number of rows in the data frame).

monitor_url

name

The role of this column.

role

The role of this column.

unit

The unit of this column.