Sha256: 155ba5cbc48e336a8cc1caed2c32018aac65e56897798b7836edeaa9bd35f700
Contents?: true
Size: 1.23 KB
Versions: 47
Compression:
Stored size: 1.23 KB
Contents
module Polars # Series.struct namespace. class StructNameSpace include ExprDispatch self._accessor = "struct" # @private def initialize(series) self._s = series._s end # Retrieve one of the fields of this `Struct` as a new Series. # # @return [Series] def [](item) if item.is_a?(Integer) field(fields[item]) elsif item.is_a?(String) field(item) else raise ArgumentError, "expected type Integer or String, got #{item.class.name}" end end # Convert this Struct Series to a DataFrame. # # @return [DataFrame] def to_frame Utils.wrap_df(_s.struct_to_frame) end # Get the names of the fields. # # @return [Array] def fields if _s.nil? [] else _s.struct_fields end end # Retrieve one of the fields of this `Struct` as a new Series. # # @param name [String] # Name of the field # # @return [Series] def field(name) super end # Rename the fields of the struct. # # @param names [Array] # New names in the order of the struct's fields # # @return [Series] def rename_fields(names) super end end end
Version data entries
47 entries across 47 versions & 1 rubygems