ibis.expr.api.StructValue.__getitem__¶
-
StructValue.
__getitem__
(field_name: str) → ibis.expr.types.ValueExpr¶ Get the field_name field from the
StructValue
expression expr.- Parameters
field_name (str) – The name of the field to access from the
Struct
typed expression expr. Must be a Pythonstr
type; programmatic struct field access is not yet supported.
Examples
>>> import ibis >>> from collections import OrderedDict >>> struct_expr = ibis.literal( ... OrderedDict([("fruit", "pear"), ("weight", 0)]) ... ) >>> struct_expr['fruit'] fruit = StructField[string] Literal[struct<fruit: string, weight: int8>] OrderedDict([('fruit', 'pear'), ('weight', 0)]) field: fruit
- Returns
value_expr – An expression with the type of the field being accessed.
- Return type
ibis.expr.types.ValueExpr