Skip to content

Commit

Permalink
docs(rust): note that weekday is actually ISO weekday (#9440)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli authored Jun 19, 2023
1 parent 4f22b83 commit 56a58e3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions polars/polars-lazy/polars-plan/src/dsl/dt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ impl DateLikeNameSpace {
.map_private(FunctionExpr::TemporalExpr(TemporalFunction::Week))
}

/// Extract the week day from the underlying Date representation.
/// Extract the ISO week day from the underlying Date representation.
/// Can be performed on Date and Datetime.
/// Returns the weekday number where monday = 0 and sunday = 6
/// Returns the weekday number where monday = 1 and sunday = 7
pub fn weekday(self) -> Expr {
self.0
.map_private(FunctionExpr::TemporalExpr(TemporalFunction::WeekDay))
Expand Down
4 changes: 2 additions & 2 deletions polars/polars-time/src/chunkedarray/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub trait DateMethods: AsDate {
ca.apply_kernel_cast::<UInt32Type>(&date_to_month)
}

/// Extract weekday from underlying NaiveDate representation.
/// Returns the weekday number where monday = 0 and sunday = 6
/// Extract ISO weekday from underlying NaiveDate representation.
/// Returns the weekday number where monday = 1 and sunday = 7
fn weekday(&self) -> UInt32Chunked {
let ca = self.as_date();
ca.apply_kernel_cast::<UInt32Type>(&date_to_iso_weekday)
Expand Down
2 changes: 1 addition & 1 deletion polars/polars-time/src/series/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ pub trait TemporalMethods: AsSeries {
dt => polars_bail!(opq = day, dt),
}
}
/// Returns the weekday number where monday = 0 and sunday = 6
/// Returns the ISO weekday number where monday = 1 and sunday = 7
fn weekday(&self) -> PolarsResult<UInt32Chunked> {
let s = self.as_series();
match s.dtype() {
Expand Down

0 comments on commit 56a58e3

Please sign in to comment.