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