pub trait PolarsUpsample {
// Required methods
fn upsample<I: IntoVec<PlSmallStr>>(
&self,
by: I,
time_column: &str,
every: Duration,
) -> PolarsResult<DataFrame>;
fn upsample_stable<I: IntoVec<PlSmallStr>>(
&self,
by: I,
time_column: &str,
every: Duration,
) -> PolarsResult<DataFrame>;
}
Required Methods§
Sourcefn upsample<I: IntoVec<PlSmallStr>>(
&self,
by: I,
time_column: &str,
every: Duration,
) -> PolarsResult<DataFrame>
fn upsample<I: IntoVec<PlSmallStr>>( &self, by: I, time_column: &str, every: Duration, ) -> PolarsResult<DataFrame>
Upsample a DataFrame
at a regular frequency.
§Arguments
by
- First group by these columns and then upsample for every grouptime_column
- Will be used to determine a date_range. Note that this column has to be sorted for the output to make sense.every
- interval will start ‘every’ durationoffset
- change the start of the date_range by this offset.
The every
and offset
arguments are created with
the following string language:
- 1ns (1 nanosecond)
- 1us (1 microsecond)
- 1ms (1 millisecond)
- 1s (1 second)
- 1m (1 minute)
- 1h (1 hour)
- 1d (1 calendar day)
- 1w (1 calendar week)
- 1mo (1 calendar month)
- 1q (1 calendar quarter)
- 1y (1 calendar year)
- 1i (1 index count)
Or combine them: “3d12h4m25s” # 3 days, 12 hours, 4 minutes, and 25 seconds
By “calendar day”, we mean the corresponding time on the next day (which may not be 24 hours, depending on daylight savings). Similarly for “calendar week”, “calendar month”, “calendar quarter”, and “calendar year”.
Sourcefn upsample_stable<I: IntoVec<PlSmallStr>>(
&self,
by: I,
time_column: &str,
every: Duration,
) -> PolarsResult<DataFrame>
fn upsample_stable<I: IntoVec<PlSmallStr>>( &self, by: I, time_column: &str, every: Duration, ) -> PolarsResult<DataFrame>
Upsample a DataFrame
at a regular frequency.
Similar to upsample
, but order of the
DataFrame is maintained when by
is specified.
§Arguments
by
- First group by these columns and then upsample for every grouptime_column
- Will be used to determine a date_range. Note that this column has to be sorted for the output to make sense.every
- interval will start ‘every’ durationoffset
- change the start of the date_range by this offset.
The every
and offset
arguments are created with
the following string language:
- 1ns (1 nanosecond)
- 1us (1 microsecond)
- 1ms (1 millisecond)
- 1s (1 second)
- 1m (1 minute)
- 1h (1 hour)
- 1d (1 calendar day)
- 1w (1 calendar week)
- 1mo (1 calendar month)
- 1q (1 calendar quarter)
- 1y (1 calendar year)
- 1i (1 index count)
Or combine them: “3d12h4m25s” # 3 days, 12 hours, 4 minutes, and 25 seconds
By “calendar day”, we mean the corresponding time on the next day (which may not be 24 hours, depending on daylight savings). Similarly for “calendar week”, “calendar month”, “calendar quarter”, and “calendar year”.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.