Sha256: 7c49792a239fe7822d31042f6d78b3928143574c5ea844da89b975efee7f5616
Contents?: true
Size: 879 Bytes
Versions: 5
Compression:
Stored size: 879 Bytes
Contents
module Polars # A rolling grouper. # # This has an `.agg` method which will allow you to run all polars expressions in a # groupby context. class RollingGroupBy def initialize( df, index_column, period, offset, closed, by, check_sorted ) period = Utils._timedelta_to_pl_duration(period) offset = Utils._timedelta_to_pl_duration(offset) @df = df @time_column = index_column @period = period @offset = offset @closed = closed @by = by @check_sorted = check_sorted end def agg(aggs) @df.lazy .groupby_rolling( index_column: @time_column, period: @period, offset: @offset, closed: @closed, by: @by, check_sorted: @check_sorted ) .agg(aggs) .collect(no_optimization: true, string_cache: false) end end end
Version data entries
5 entries across 5 versions & 1 rubygems