w3resource

Pandas Series: dt.day_name() function

Series.dt.day_name() function

The dt.day_name() function is used to get the day names of the DateTimeIndex with specified locale.

Syntax:

Series.dt.day_name(self, *args, **kwargs)
Pandas Series: dt.day_name() function

Parameter:

Name Description Type / Default Value Required / Optional
locale Locale determining the language in which to return the day name. Default is English locale. str Optional

Returns: Index
Index of day names.

Example:

Python-Pandas Code:

import numpy as np
import pandas as pd
idx = pd.date_range(start='2019-02-01', freq='D', periods=4)
idx

Output:

DatetimeIndex(['2019-02-01', '2019-02-02', '2019-02-03', '2019-02-04'], dtype='datetime64[ns]', freq='D')

Python-Pandas Code:

import numpy as np
import pandas as pd
idx = pd.date_range(start='2019-02-01', freq='D', periods=4)
idx.day_name()

Output:

Index(['Friday', 'Saturday', 'Sunday', 'Monday'], dtype='object')

Previous: Series.dt.month_name() function
Next: Series-dt.components() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/pandas/series/series-dt-day_name.php