Skip to main content

DatetimeAccessor

Struct DatetimeAccessor 

Source
pub struct DatetimeAccessor<'a> { /* private fields */ }

Implementations§

Source§

impl DatetimeAccessor<'_>

Source

pub fn year(&self) -> Result<Series, FrameError>

Extract year component.

Matches pd.Series.dt.year.

Source

pub fn month(&self) -> Result<Series, FrameError>

Extract month component (1-12).

Matches pd.Series.dt.month.

Source

pub fn day(&self) -> Result<Series, FrameError>

Extract day component (1-31).

Matches pd.Series.dt.day.

Source

pub fn hour(&self) -> Result<Series, FrameError>

Extract hour component (0-23).

Matches pd.Series.dt.hour.

Source

pub fn minute(&self) -> Result<Series, FrameError>

Extract minute component (0-59).

Matches pd.Series.dt.minute.

Source

pub fn second(&self) -> Result<Series, FrameError>

Extract second component (0-59).

Matches pd.Series.dt.second.

Source

pub fn microsecond(&self) -> Result<Series, FrameError>

Extract microsecond component (0-999999).

Matches pd.Series.dt.microsecond.

Source

pub fn nanosecond(&self) -> Result<Series, FrameError>

Extract nanosecond component (0-999).

Matches pd.Series.dt.nanosecond.

Source

pub fn dayofweek(&self) -> Result<Series, FrameError>

Extract day of week (Monday=0, Sunday=6).

Matches pd.Series.dt.dayofweek / pd.Series.dt.weekday.

Source

pub fn weekday(&self) -> Result<Series, FrameError>

Alias for dayofweek(). Matches pd.Series.dt.weekday.

Source

pub fn day_of_week(&self) -> Result<Series, FrameError>

Alias for dayofweek(). Matches pd.Series.dt.day_of_week.

Source

pub fn date(&self) -> Result<Series, FrameError>

Extract date part as string (YYYY-MM-DD).

Matches pd.Series.dt.date.

Source

pub fn time(&self) -> Result<Series, FrameError>

Extract time part as string (HH:MM:SS).

Matches pd.Series.dt.time.

Source

pub fn tz(&self) -> Result<Series, FrameError>

Extract timezone info from datetime strings.

Returns the timezone suffix (e.g., “+00:00”, “Z”, “-05:00”) or None for naive (timezone-unaware) datetimes.

Matches pd.Series.dt.tz inspection pattern.

Source

pub fn timetz(&self) -> Result<Series, FrameError>

Extract time with timezone info preserved (HH:MM:SS+TZ).

Matches pd.Series.dt.timetz which returns time objects with tzinfo. For naive datetimes, returns time without timezone suffix.

Source

pub fn components(&self) -> Result<DataFrame, FrameError>

Returns DataFrame with datetime components (year, month, day, hour, minute, second).

Similar to pd.Series.dt.components for Timedelta, but for datetime values.

Source

pub fn quarter(&self) -> Result<Series, FrameError>

Extract quarter (1-4).

Matches pd.Series.dt.quarter.

Source

pub fn dayofyear(&self) -> Result<Series, FrameError>

Extract day of year (1-366).

Matches pd.Series.dt.dayofyear.

Source

pub fn day_of_year(&self) -> Result<Series, FrameError>

Alias for dayofyear(). Matches pd.Series.dt.day_of_year.

Source

pub fn weekofyear(&self) -> Result<Series, FrameError>

Extract ISO week number (1-53).

Matches pd.Series.dt.isocalendar().week.

Source

pub fn week(&self) -> Result<Series, FrameError>

Alias for weekofyear(). Matches pd.Series.dt.week.

Source

pub fn isocalendar(&self) -> Result<DataFrame, FrameError>

Returns a DataFrame with ISO calendar columns: year, week, day.

Matches pd.Series.dt.isocalendar().

Source

pub fn is_month_start(&self) -> Result<Series, FrameError>

Check if date is the first day of the month.

Matches pd.Series.dt.is_month_start.

Source

pub fn is_month_end(&self) -> Result<Series, FrameError>

Check if date is the last day of the month.

Matches pd.Series.dt.is_month_end.

Source

pub fn is_quarter_start(&self) -> Result<Series, FrameError>

Check if date is the first day of a quarter.

Matches pd.Series.dt.is_quarter_start.

Source

pub fn is_quarter_end(&self) -> Result<Series, FrameError>

Check if date is the last day of a quarter.

Matches pd.Series.dt.is_quarter_end.

Source

pub fn strftime(&self, format: &str) -> Result<Series, FrameError>

Format datetime using strftime-like directives.

Matches pd.Series.dt.strftime(format). Supports: %Y, %m, %d, %H, %M, %S.

Source

pub fn days_in_month(&self) -> Result<Series, FrameError>

Number of days in the month of each datetime.

Matches pd.Series.dt.days_in_month.

Source

pub fn daysinmonth(&self) -> Result<Series, FrameError>

Alias for days_in_month(). Matches pd.Series.dt.daysinmonth.

Source

pub fn is_leap_year(&self) -> Result<Series, FrameError>

Whether the year of each datetime is a leap year.

Matches pd.Series.dt.is_leap_year.

Source

pub fn is_year_start(&self) -> Result<Series, FrameError>

Whether each datetime is the start of the year (Jan 1).

Matches pd.Series.dt.is_year_start.

Source

pub fn is_year_end(&self) -> Result<Series, FrameError>

Whether each datetime is the end of the year (Dec 31).

Matches pd.Series.dt.is_year_end.

Source

pub fn month_name(&self) -> Result<Series, FrameError>

Full month name (e.g. “January”) for each datetime.

Matches pd.Series.dt.month_name().

Source

pub fn day_name(&self) -> Result<Series, FrameError>

Full day name (e.g. “Monday”) for each datetime.

Matches pd.Series.dt.day_name(). Uses Zeller’s congruence.

Source

pub fn total_seconds(&self) -> Result<Series, FrameError>

Total seconds for each timedelta value.

Per br-frankenpandas-i9bah: pandas dt.total_seconds() is for timedelta dtype, not datetime. Returns Float64 (fractional seconds supported). Errors if the series contains datetime strings (pandas has no dt.total_seconds() for datetime).

Source

pub fn to_timestamp(&self) -> Result<Series, FrameError>

Convert period-like strings to full timestamp strings.

Matches pd.Series.dt.to_timestamp(). For date-only strings (“YYYY-MM-DD”), appends “00:00:00” to produce a full datetime. Month periods (“YYYY-MM”) become “YYYY-MM-01 00:00:00”. Year periods (“YYYY”) become “YYYY-01-01 00:00:00”.

Source

pub fn to_timestamp_with_how(&self, how: &str) -> Result<Series, FrameError>

Convert period-like strings to full timestamp strings using the requested boundary.

Matches pd.Series.dt.to_timestamp(how='start'|'end') for year/month/day-like periods.

Source

pub fn to_pydatetime(&self) -> Result<Series, FrameError>

Convert datetime-like strings to Python-datetime-compatible strings.

Matches pd.Series.dt.to_pydatetime(warn=...) in observable value output. Nanoseconds beyond microsecond precision are truncated to match Python’s datetime precision.

Source

pub fn to_pydatetime_with_warn(&self, warn: bool) -> Result<Series, FrameError>

Convert datetime-like strings to Python-datetime-compatible strings, optionally suppressing pandas’ nanosecond-loss warning.

Source

pub fn floor(&self, freq: &str) -> Result<Series, FrameError>

Round each datetime down (floor) to the given frequency.

Matches pd.Series.dt.floor(freq). Supported frequencies: “D”, “h”/“H”, “min”/“T”, “s”/“S”, “ms”, “us”, “ns”.

Source

pub fn ceil(&self, freq: &str) -> Result<Series, FrameError>

Round each datetime up (ceil) to the given frequency.

Matches pd.Series.dt.ceil(freq). Same frequencies as floor.

Source

pub fn round(&self, freq: &str) -> Result<Series, FrameError>

Round each datetime to the nearest given frequency.

Matches pd.Series.dt.round(freq). Ties round half-to-even on the frequency-unit count, like pandas. Same frequencies as floor.

Source

pub fn normalize(&self) -> Result<Series, FrameError>

Normalize each datetime to midnight (set time to 00:00:00).

Matches pd.Series.dt.normalize(). Equivalent to floor("D").

Source

pub fn tz_localize(&self, tz: Option<&str>) -> Result<Series, FrameError>

Localize tz-naive datetimes to a timezone or remove existing timezone data.

Matches pd.Series.dt.tz_localize(tz). Some(tz) appends timezone info to each naive datetime string. None removes timezone info while keeping the local clock-time representation.

Source

pub fn tz_localize_with_options( &self, tz: Option<&str>, options: TzLocalizeOptions, ) -> Result<Series, FrameError>

Localize tz-naive datetimes with explicit DST ambiguity/nonexistence policy.

Source

pub fn tz_convert(&self, tz: Option<&str>) -> Result<Series, FrameError>

Convert timezone-aware datetimes to a different timezone or to UTC-naive values.

Matches pd.Series.dt.tz_convert(tz). Some(tz) adjusts the UTC offset and replaces the timezone suffix. None converts through UTC and then removes timezone information.

Auto Trait Implementations§

§

impl<'a> Freeze for DatetimeAccessor<'a>

§

impl<'a> RefUnwindSafe for DatetimeAccessor<'a>

§

impl<'a> Send for DatetimeAccessor<'a>

§

impl<'a> Sync for DatetimeAccessor<'a>

§

impl<'a> Unpin for DatetimeAccessor<'a>

§

impl<'a> UnsafeUnpin for DatetimeAccessor<'a>

§

impl<'a> UnwindSafe for DatetimeAccessor<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.