Not sure if this is feasible or if there is support for it.

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DatetimeIndex.dayofweek.html gives the day of the week with Monday=0, Sunday=6.

For my application I would like Sunday=0 and Saturday=6.

I wonder if there could be a startday argument to dayofweek? e.g. dayoftheweek(startday='Sunday') with dayoftheweek(startday='Monday') being the default.

I used a workaround in my case:

df['weekday'] = df.index.dayofweek 
df_weekday_mean = df.groupby('weekday').mean()
df_weekday_mean = df_weekday_mean.iloc[np.arange(-1, len(df_weekday_mean)-1)].reset_index()

Output of pd.show_versions()

[paste the output of ``pd.show_versions()`` here below this line] INSTALLED VERSIONS ------------------ commit: None python: 3.6.7.final.0 python-bits: 64 OS: Windows OS-release: 7 machine: AMD64 processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None pandas: 0.23.4 pytest: 3.9.1 pip: 10.0.1 setuptools: 40.4.3 Cython: 0.29 numpy: 1.15.3 scipy: 1.1.0 pyarrow: None xarray: None IPython: 7.0.1 sphinx: 1.8.1 patsy: 0.5.0 dateutil: 2.7.3 pytz: 2018.5 blosc: None bottleneck: 1.2.1 tables: 3.4.4 numexpr: 2.6.8 feather: None matplotlib: 3.0.1 openpyxl: 2.5.9 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.1.2 lxml: 4.2.5 bs4: 4.6.3 html5lib: 1.0.1 sqlalchemy: 1.2.12 pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None

Comment From: chris-b1

I think it's a reasonable idea, but would be a breaking API change to turn the property into callable, so a bit painful.

You could shift the days yourself more directly with addition/modulo

df = pd.DataFrame({'date': pd.date_range('2014-01-01', periods=10)})
df['day_name'] = df.date.dt.day_name()

df['dayofweek-MON'] = df.date.dt.dayofweek
df['dayofweek-SUN'] = (df.date.dt.dayofweek + 1) % 7
df['dayofweek-SAT'] = (df.date.dt.dayofweek + 2) % 7


In [26]: df
Out[26]: 
        date   day_name  dayofweek-MON  dayofweek-SUN  dayofweek-SAT
0 2014-01-01  Wednesday              2              3              4
1 2014-01-02   Thursday              3              4              5
2 2014-01-03     Friday              4              5              6
3 2014-01-04   Saturday              5              6              0
4 2014-01-05     Sunday              6              0              1
5 2014-01-06     Monday              0              1              2
6 2014-01-07    Tuesday              1              2              3
7 2014-01-08  Wednesday              2              3              4
8 2014-01-09   Thursday              3              4              5

Comment From: mroeschke

Thanks for the suggestion, but since there hasn't been much community or core dev interest in years going to close for now. Happy to reopen if there's renewed interest