feat: add 'weekday' property to DatatimeMethod (#2304) · googleapis/python-bigquery-dataframes@fafd7c7 · GitHub
Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit fafd7c7

Browse files
authored
feat: add 'weekday' property to DatatimeMethod (#2304)
Fixes b/464971054 🦕
1 parent 37c685d commit fafd7c7

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

bigframes/operations/datetimes.py

Lines changed: 4 additions & 0 deletions

tests/system/small/operations/test_datetimes.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ def test_dt_day_of_week(scalars_dfs, col_name):
108108
assert_series_equal(pd_result, bf_result, check_dtype=False)
109109

110110

111+
@pytest.mark.parametrize(
112+
("col_name",),
113+
DATE_COLUMNS,
114+
)
115+
def test_dt_weekday(scalars_dfs, col_name):
116+
pytest.importorskip("pandas", minversion="2.0.0")
117+
scalars_df, scalars_pandas_df = scalars_dfs
118+
bf_series: bigframes.series.Series = scalars_df[col_name]
119+
120+
bf_result = bf_series.dt.weekday.to_pandas()
121+
pd_result = scalars_pandas_df[col_name].dt.weekday
122+
123+
assert_series_equal(pd_result, bf_result, check_dtype=False)
124+
125+
111126
@pytest.mark.parametrize(
112127
("col_name",),
113128
DATE_COLUMNS,

third_party/bigframes_vendored/pandas/core/indexes/accessor.py

Lines changed: 31 additions & 0 deletions

0 commit comments

Comments
 (0)