Operators Support

Standard Python Operators

operator

description

hgraph name

TS[int] TS[float]

TS[bool]

TS[str]

TS[enum]

TS[date,datetime]

TS[timedelta]

TS[CompoundScalar]

TS[tuple]

TS[set]

TS[dict]

TSS[T]

TSL[TST, S]

TSB[Schema]

TSD[K, V]

a + b

addition

add_

✅ b is timedelta

✅ concat tuples

✅ item-wise

✅ item-wise

a - b

subtraction

sub_

✅ set diff

✅ diff

✅ set difference

✅ item-wise

✅ item-wise

✅ diff

a * b

multiplication

mul_

✅ b is int

✅ b is int/float

✅ b is int

✅ item-wise

✅ item-wise

a / b

true division

div_

✅ b is int/float

✅ item-wise

✅ item-wise

a // b

floor division

floordiv_

✅ item-wise

✅ item-wise

a % b

modulo

mod_

✅ item-wise

✅ item-wise

divmod(a, b)

divmod

divmod_

a ** b

pow

pow_

✅ item-wise

✅ item-wise

a << b

left shift

lshift_

❓ shift items left

✅ item-wise

✅ item-wise

a >> b

right shift

rshift_

✅ item-wise

✅ item-wise

a & b

bitwise and

bit_and

✅ intersection

❓ intersection

✅ intersection

✅ item-wise

✅ item-wise

✅ intersection

a | b

bitwise or

bit_or

✅ union

❓ union

✅ union

✅ item-wise

✅ item-wise

✅ merge

a ^ b

bitwise xor

bit_xor

✅ symm. diff

❓ symm. diff

✅ symm. diff

✅ item-wise

✅ item-wise

✅ symm. diff

a == b

equal

eq_

✅ single bool

✅ single bool

a != b

not equal

ne_

✅ single bool

✅ single bool

a < b

less

lt_

✅ value

a <= b

less or equal

le_

✅ value

a > b

greater

gt_

✅ value

a >= b

greater or equal

ge_

✅ value

-a

unary negative

neg_

✅ item-wise

✅ item-wise

+a

unary positive

pos_

✅ item-wise

✅ item-wise

~a

inversion

invert_

✅ item-wise

✅ item-wise

abs(a)

abs

abs_

✅ item-wise

✅ item-wise

a[b]

getitem

getitem_

✅ item by index

✅ item by index

a.b

getattr

getattr_

✅ item by name

✅ if values is a schema type

&nbsp;

not_(a)

not

not_

and_(a, b)

and

and_

or_(a, b)

or

or_

len_(a)

len

len_

✅ number of items

&nbsp;

min_(*args)

multi-arg min

min_

✅ value

✅ item-wise

✅ item-wise

max_(*args)

multi-arg max

max_

✅ value

✅ item-wise

✅ item-wise

sum_(*args)

multi-arg sum

sum_

✅ item-wise

✅ item-wise

min_(a)

unary min

min_

✅ running min

✅ running min

✅ running min

✅ running min

✅ running min

✅ running min

✅ min item

✅ min item

✅ min value

✅ min item

✅ min item

✅ min item

✅ min value

max_(a)

unary max

max_

✅ running max

✅ running max

✅ running max

✅ running max

✅ running max

✅ running max

✅ max item

✅ max item

✅ max value

✅ max item

✅ max item

✅ max item

✅ max value

sum_(a)

unary sum

sum_

✅ running sum

✅ running sum

✅ running sum

✅ running sum

✅ sum items

✅ sum items

✅ sum values

✅ sum items

✅ sum items

✅ sum items

✅ sum value

&nbsp;

contains(a, b)

b in a

contains_

✅ substring find

✅ key find

is_empty(a)

empty test

is_empty

type_(a)

type

type_

✅ int or float

✅ bool

✅ str

✅ enum

✅ date or datetime

✅ timedelta

✅ tuple[…]

✅ set[…]

✅ set[…]

str_(a)

str

str_

✅ no-op

&nbsp;

convert

from to

TS[T], T is int, float

TS[bool]

TS[str]

TS[CompoundScalar]

TS[tuple]

TS[set]

TS[dict]

TSS[T]

TSL[TST, S]

TSB[Schema]

TSD[K, V]

TS[T], T is int, float

✅ tuple of one

✅ tuple of one

✅ key and value inputs

✅ set of one

TS[bool]

✅ tuple of one

✅ tuple of one

TS[str]

✅ tuple of one

✅ tuple of one

✅ set of one

TS[CompoundScalar]

TS[tuple]

✅ key and value tuples

TS[set]

✅ if supplied a value

TS[dict]

✅ for uniform schemas

TSS[T]

✅ if supplied a value

TSL[TST, S]

✅ ints for keys

✅ with int keys, or use combine with a tuple of keys

TSB[Schema]

✅ if the schema is uniform

TSD[K, V]

✅ for uniform schemas

combine

from to

TS[tuple]

TS[set]

TS[Mapping]

TSS[T]

TSL[TST, S]

TSB[Schema]

TSD[K, V]

TS[T], T is int, float, bool, str

✅ from two inputs for K and V

✅ for two inputs, K and V

TS[tuple]

✅ same as sums

✅ from two inputs for K and V

✅ for two inputs, K and V

TS[set]

TS[Mapping]

TSS[T]

TSD[K, V]

emit

input type

output type

TS[tuple[SCALAR, …]]

TS[SCALAR]

TS[set[SCALAR]]

TS[SCALAR]

TS[Mapping[K, V]]

TS[V]

TSS[SCALAR]

TS[SCALAR]

TSL[T, SIZE]

T

TSD[K, V]

V