Class: Polars::DataTypeExpr
- Inherits:
-
Object
- Object
- Polars::DataTypeExpr
- Defined in:
- lib/polars/data_type_expr.rb
Overview
A lazily instantiated DataType
that can be used in an Expr
.
Instance Method Summary collapse
-
#collect_dtype(context) ⇒ DataType
Materialize the
DataTypeExpr
in a specific context.
Instance Method Details
#collect_dtype(context) ⇒ DataType
Materialize the DataTypeExpr
in a specific context.
This is a useful function when debugging datatype expressions.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/polars/data_type_expr.rb', line 32 def collect_dtype( context ) schema = nil if context.is_a?(Schema) schema = context elsif context.is_a?(Hash) schema = Schema.new(context) elsif context.is_a?(DataFrame) schema = context.schema elsif context.is_a?(LazyFrame) schema = context.collect_schema else msg = "DataTypeExpr.collect_dtype did not expect #{context.inspect}" raise TypeError, msg end _rbdatatype_expr.collect_dtype(schema.to_h) end |