Path: blob/main/crates/polars-time/src/chunkedarray/mod.rs
6939 views
//! Traits and utilities for temporal data.1#[cfg(feature = "dtype-date")]2mod date;3#[cfg(feature = "dtype-datetime")]4mod datetime;5#[cfg(feature = "dtype-duration")]6mod duration;7mod kernels;8#[cfg(any(feature = "rolling_window", feature = "rolling_window_by"))]9mod rolling_window;10pub mod string;11#[cfg(feature = "dtype-time")]12mod time;1314use arrow::legacy::utils::CustomIterTools;15use chrono::{NaiveDate, NaiveDateTime, NaiveTime};16#[cfg(feature = "dtype-date")]17pub use date::DateMethods;18#[cfg(feature = "dtype-datetime")]19pub use datetime::DatetimeMethods;20#[cfg(feature = "dtype-duration")]21pub use duration::DurationMethods;22use kernels::*;23use polars_core::prelude::*;24#[cfg(any(feature = "rolling_window", feature = "rolling_window_by"))]25pub use rolling_window::*;26pub use string::StringMethods;27#[cfg(feature = "dtype-time")]28pub use time::TimeMethods;2930// a separate function so that it is not compiled twice31#[cfg(any(feature = "dtype-date", feature = "dtype-datetime"))]32pub(crate) fn months_to_quarters(mut ca: Int8Chunked) -> Int8Chunked {33ca.apply_mut(|month| (month + 2) / 3);34ca35}363738