Integer, floating point, decimal, and boolean expressions.

NumericColumn

NumericColumn(self, arg)

Methods

NameDescription
absReturn the absolute value of self.
acosCompute the arc cosine of self.
asinCompute the arc sine of self.
atanCompute the arc tangent of self.
atan2Compute the two-argument version of arc tangent.
bucketCompute a discrete binning of a numeric array.
ceilReturn the ceiling of self.
corrReturn the correlation of two numeric columns.
cosCompute the cosine of self.
cotCompute the cotangent of self.
covReturn the covariance of two numeric columns.
degreesCompute the degrees of self radians.
expCompute eselfe^\texttt{self}.
floorReturn the floor of an expression.
lnCompute ln(self)\ln\left(\texttt{self}\right).
logCompute logbase(self)\log_{\texttt{base}}\left(\texttt{self}\right).
log10Compute log10(self)\log_{10}\left(\texttt{self}\right).
log2Compute log2(self)\log_{2}\left(\texttt{self}\right).
meanReturn the mean of a numeric column.
negateNegate a numeric expression.
radiansCompute radians from self degrees.
roundRound values to an indicated number of decimal places.
signReturn the sign of the input.
sinCompute the sine of self.
sqrtCompute the square root of self.
stdReturn the standard deviation of a numeric column.
sumReturn the sum of a numeric column.
tanCompute the tangent of self.
varReturn the variance of a numeric column.

abs

abs()

Return the absolute value of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 2, -3, 4]})
>>> t.values.abs()
┏━━━━━━━━━━━━━┓
┃ Abs(values)
┡━━━━━━━━━━━━━┩
│ int64       │
├─────────────┤
1
2
3
4
└─────────────┘

acos

acos()

Compute the arc cosine of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.acos()
┏━━━━━━━━━━━━━━┓
┃ Acos(values)
┡━━━━━━━━━━━━━━┩
│ float64      │
├──────────────┤
3.141593
1.570796
0.000000
└──────────────┘

asin

asin()

Compute the arc sine of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.asin()
┏━━━━━━━━━━━━━━┓
┃ Asin(values)
┡━━━━━━━━━━━━━━┩
│ float64      │
├──────────────┤
-1.570796
0.000000
1.570796
└──────────────┘

atan

atan()

Compute the arc tangent of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.atan()
┏━━━━━━━━━━━━━━┓
┃ Atan(values)
┡━━━━━━━━━━━━━━┩
│ float64      │
├──────────────┤
-0.785398
0.000000
0.785398
└──────────────┘

atan2

atan2(other)

Compute the two-argument version of arc tangent.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.atan2(0)
┏━━━━━━━━━━━━━━━━━━┓
┃ Atan2(values, 0)
┡━━━━━━━━━━━━━━━━━━┩
│ float64          │
├──────────────────┤
-1.570796
0.000000
1.570796
└──────────────────┘

bucket

bucket(
    buckets,
    closed='left',
    close_extreme=True,
    include_under=False,
    include_over=False,
)

Compute a discrete binning of a numeric array.

Parameters

NameTypeDescriptionDefault
bucketsSequence[int]List of bucketsrequired
closedLiteral[‘left’, ‘right’]Which side of each interval is closed. For example: python buckets = [0, 100, 200] closed = "left" # 100 falls in 2nd bucket closed = "right" # 100 falls in 1st bucket'left'
close_extremeboolWhether the extreme values fall in the last bucketTrue
include_overboolInclude values greater than the last bucket in the last bucketFalse
include_underboolInclude values less than the first bucket in the first bucketFalse

Returns

NameTypeDescription
IntegerColumnA categorical column expression

ceil

ceil()

Return the ceiling of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [1, 1.1, 2, 2.1, 3.3]})
>>> t.values.ceil()
┏━━━━━━━━━━━━━━┓
┃ Ceil(values)
┡━━━━━━━━━━━━━━┩
│ int64        │
├──────────────┤
1
2
2
3
4
└──────────────┘

corr

corr(right, where=None, how='sample')

Return the correlation of two numeric columns.

Parameters

NameTypeDescriptionDefault
rightNumericColumnNumeric columnrequired
whereir.BooleanValue | NoneFilterNone
howLiteral[‘sample’, ‘pop’]Population or sample correlation'sample'

Returns

NameTypeDescription
NumericScalarThe correlation of left and right

cos

cos()

Compute the cosine of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.cos()
┏━━━━━━━━━━━━━┓
┃ Cos(values)
┡━━━━━━━━━━━━━┩
│ float64     │
├─────────────┤
0.540302
1.000000
0.540302
└─────────────┘

cot

cot()

Compute the cotangent of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, -2, 3]})
>>> t.values.cot()
┏━━━━━━━━━━━━━┓
┃ Cot(values)
┡━━━━━━━━━━━━━┩
│ float64     │
├─────────────┤
-0.642093
0.457658
-7.015253
└─────────────┘

cov

cov(right, where=None, how='sample')

Return the covariance of two numeric columns.

Parameters

NameTypeDescriptionDefault
rightNumericColumnNumeric columnrequired
whereir.BooleanValue | NoneFilterNone
howLiteral[‘sample’, ‘pop’]Population or sample covariance'sample'

Returns

NameTypeDescription
NumericScalarThe covariance of self and right

degrees

degrees()

Compute the degrees of self radians.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> from math import pi
>>> t = ibis.memtable({"values": [0, pi / 2, pi, 3 * pi / 2, 2 * pi]})
>>> t.values.degrees()
┏━━━━━━━━━━━━━━━━━┓
┃ Degrees(values)
┡━━━━━━━━━━━━━━━━━┩
│ float64         │
├─────────────────┤
0.0
90.0
180.0
270.0
360.0
└─────────────────┘

exp

exp()

Compute eselfe^\texttt{self}.

Returns

NameTypeDescription
NumericValueeselfe^\texttt{self}

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": range(4)})
>>> t.values.exp()
┏━━━━━━━━━━━━━┓
┃ Exp(values)
┡━━━━━━━━━━━━━┩
│ float64     │
├─────────────┤
1.000000
2.718282
7.389056
20.085537
└─────────────┘

floor

floor()

Return the floor of an expression.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [1, 1.1, 2, 2.1, 3.3]})
>>> t.values.floor()
┏━━━━━━━━━━━━━━━┓
┃ Floor(values)
┡━━━━━━━━━━━━━━━┩
│ int64         │
├───────────────┤
1
1
2
2
3
└───────────────┘

ln

ln()

Compute ln(self)\ln\left(\texttt{self}\right).

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [1, 2.718281828, 3]})
>>> t.values.ln()
┏━━━━━━━━━━━━┓
┃ Ln(values)
┡━━━━━━━━━━━━┩
│ float64    │
├────────────┤
0.000000
1.000000
1.098612
└────────────┘

log

log(base=None)

Compute logbase(self)\log_{\texttt{base}}\left(\texttt{self}\right).

Parameters

NameTypeDescriptionDefault
baseNumericValue | NoneThe base of the logarithm. If None, base e is used.None

Returns

NameTypeDescription
NumericValueLogarithm of arg with base base

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> from math import e
>>> t = ibis.memtable({"values": [e, e**2, e**3]})
>>> t.values.log()
┏━━━━━━━━━━━━━┓
┃ Log(values)
┡━━━━━━━━━━━━━┩
│ float64     │
├─────────────┤
1.0
2.0
3.0
└─────────────┘
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [10, 100, 1000]})
>>> t.values.log(base=10)
┏━━━━━━━━━━━━━━━━━┓
┃ Log(values, 10)
┡━━━━━━━━━━━━━━━━━┩
│ float64         │
├─────────────────┤
1.0
2.0
3.0
└─────────────────┘

log10

log10()

Compute log10(self)\log_{10}\left(\texttt{self}\right).

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [1, 10, 100]})
>>> t.values.log10()
┏━━━━━━━━━━━━━━━┓
┃ Log10(values)
┡━━━━━━━━━━━━━━━┩
│ float64       │
├───────────────┤
0.0
1.0
2.0
└───────────────┘

log2

log2()

Compute log2(self)\log_{2}\left(\texttt{self}\right).

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [1, 2, 4, 8]})
>>> t.values.log2()
┏━━━━━━━━━━━━━━┓
┃ Log2(values)
┡━━━━━━━━━━━━━━┩
│ float64      │
├──────────────┤
0.0
1.0
2.0
3.0
└──────────────┘

mean

mean(where=None)

Return the mean of a numeric column.

Parameters

NameTypeDescriptionDefault
whereir.BooleanValue | NoneFilterNone

Returns

NameTypeDescription
NumericScalarThe mean of the input expression

negate

negate()

Negate a numeric expression.

Returns

NameTypeDescription
NumericValueA numeric value expression

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.negate()
┏━━━━━━━━━━━━━━━━┓
┃ Negate(values)
┡━━━━━━━━━━━━━━━━┩
│ int64          │
├────────────────┤
1
0
-1
└────────────────┘

radians

radians()

Compute radians from self degrees.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [0, 90, 180, 270, 360]})
>>> t.values.radians()
┏━━━━━━━━━━━━━━━━━┓
┃ Radians(values)
┡━━━━━━━━━━━━━━━━━┩
│ float64         │
├─────────────────┤
0.000000
1.570796
3.141593
4.712389
6.283185
└─────────────────┘

round

round(digits=None)

Round values to an indicated number of decimal places.

Parameters

NameTypeDescriptionDefault
digitsint | IntegerValue | NoneThe number of digits to round to. Here’s how the digits parameter affects the expression output type: - digits is False-y; self.type() is decimaldecimal - digits is nonzero; self.type() is decimaldecimal - digits is False-y; self.type() is Floating → int64 - digits is nonzero; self.type() is Floating → float64None

Returns

NameTypeDescription
NumericValueThe rounded expression

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [1.22, 1.64, 2.15, 2.54]})
>>> t
┏━━━━━━━━━┓
┃ values  ┃
┡━━━━━━━━━┩
│ float64 │
├─────────┤
1.22
1.64
2.15
2.54
└─────────┘
>>> t.values.round()
┏━━━━━━━━━━━━━━━┓
┃ Round(values)
┡━━━━━━━━━━━━━━━┩
│ int64         │
├───────────────┤
1
2
2
3
└───────────────┘
>>> t.values.round(digits=1)
┏━━━━━━━━━━━━━━━━━━┓
┃ Round(values, 1)
┡━━━━━━━━━━━━━━━━━━┩
│ float64          │
├──────────────────┤
1.2
1.6
2.2
2.5
└──────────────────┘

sign

sign()

Return the sign of the input.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 2, -3, 4]})
>>> t.values.sign()
┏━━━━━━━━━━━━━━┓
┃ Sign(values)
┡━━━━━━━━━━━━━━┩
│ int64        │
├──────────────┤
-1
1
-1
1
└──────────────┘

sin

sin()

Compute the sine of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.sin()
┏━━━━━━━━━━━━━┓
┃ Sin(values)
┡━━━━━━━━━━━━━┩
│ float64     │
├─────────────┤
-0.841471
0.000000
0.841471
└─────────────┘

sqrt

sqrt()

Compute the square root of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [1, 4, 9, 16]})
>>> t.values.sqrt()
┏━━━━━━━━━━━━━━┓
┃ Sqrt(values)
┡━━━━━━━━━━━━━━┩
│ float64      │
├──────────────┤
1.0
2.0
3.0
4.0
└──────────────┘

std

std(where=None, how='sample')

Return the standard deviation of a numeric column.

Parameters

NameTypeDescriptionDefault
whereir.BooleanValue | NoneFilterNone
howLiteral[‘sample’, ‘pop’]Sample or population standard deviation'sample'

Returns

NameTypeDescription
NumericScalarStandard deviation of arg

sum

sum(where=None)

Return the sum of a numeric column.

Parameters

NameTypeDescriptionDefault
whereir.BooleanValue | NoneFilterNone

Returns

NameTypeDescription
NumericScalarThe sum of the input expression

tan

tan()

Compute the tangent of self.

Examples

>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable({"values": [-1, 0, 1]})
>>> t.values.tan()
┏━━━━━━━━━━━━━┓
┃ Tan(values)
┡━━━━━━━━━━━━━┩
│ float64     │
├─────────────┤
-1.557408
0.000000
1.557408
└─────────────┘

var

var(where=None, how='sample')

Return the variance of a numeric column.

Parameters

NameTypeDescriptionDefault
whereir.BooleanValue | NoneFilterNone
howLiteral[‘sample’, ‘pop’]Sample or population variance'sample'

Returns

NameTypeDescription
NumericScalarStandard deviation of arg

IntegerColumn

IntegerColumn(self, arg)

Methods

NameDescription
bit_andAggregate the column using the bitwise and operator.
bit_orAggregate the column using the bitwise or operator.
bit_xorAggregate the column using the bitwise exclusive or operator.
to_timestamp

bit_and

bit_and(where=None)

Aggregate the column using the bitwise and operator.

bit_or

bit_or(where=None)

Aggregate the column using the bitwise or operator.

bit_xor

bit_xor(where=None)

Aggregate the column using the bitwise exclusive or operator.

to_timestamp

to_timestamp(unit='s')

FloatingColumn

FloatingColumn(self, arg)

Methods

NameDescription
isinfReturn whether the value is infinity.
isnanReturn whether the value is NaN.

isinf

isinf()

Return whether the value is infinity.

isnan

isnan()

Return whether the value is NaN.