Skip to main content

polars_time/chunkedarray/
mod.rs

1//! Traits and utilities for temporal data.
2#[cfg(feature = "dtype-date")]
3mod date;
4#[cfg(feature = "dtype-datetime")]
5mod datetime;
6#[cfg(feature = "dtype-duration")]
7mod duration;
8mod kernels;
9#[cfg(any(feature = "rolling_window", feature = "rolling_window_by"))]
10mod rolling_window;
11#[cfg(feature = "dtype-time")]
12mod time;
13
14use chrono::{NaiveDate, NaiveDateTime, NaiveTime};
15#[cfg(feature = "dtype-date")]
16pub use date::DateMethods;
17#[cfg(feature = "dtype-datetime")]
18pub use datetime::DatetimeMethods;
19#[cfg(feature = "dtype-duration")]
20pub use duration::DurationMethods;
21use kernels::*;
22use polars_arrow::legacy::utils::CustomIterTools;
23use polars_core::prelude::*;
24#[cfg(any(feature = "rolling_window", feature = "rolling_window_by"))]
25pub use rolling_window::*;
26#[cfg(feature = "dtype-time")]
27pub use time::TimeMethods;
28
29// a separate function so that it is not compiled twice
30#[cfg(any(feature = "dtype-date", feature = "dtype-datetime"))]
31pub(crate) fn months_to_quarters(mut ca: Int8Chunked) -> Int8Chunked {
32    ca.apply_mut(|month| (month + 2) / 3);
33    ca
34}