pandas.DatetimeIndex.day_name¶
- DatetimeIndex.day_name(*args, **kwargs)[source]¶
Return the day names with specified locale.
- Parameters
- localestr, optional
Locale determining the language in which to return the day name. Default is English locale.
- Returns
- Series or Index
Series or Index of day names.
Examples
>>> s = pd.Series(pd.date_range(start='2018-01-01', freq='D', periods=3)) >>> s 0 2018-01-01 1 2018-01-02 2 2018-01-03 dtype: datetime64[ns] >>> s.dt.day_name() 0 Monday 1 Tuesday 2 Wednesday dtype: object
>>> idx = pd.date_range(start='2018-01-01', freq='D', periods=3) >>> idx DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'], dtype='datetime64[ns]', freq='D') >>> idx.day_name() Index(['Monday', 'Tuesday', 'Wednesday'], dtype='object')