Pandas Timestamp function day_name() in Python
The Pandas Timestamp function day_name() used to returns the day name based on specified Timestamp object. It returns string that represents the day on the specified Timestamp based on locale.
Syntax
 1 Timestamp.day_name(locale)
locale : It is string that specifies the Locale to determine the language in which a day name will be returned.
day_name() function
 1 import pandas as pd
 2 
 3 timestamp = pd.Timestamp(2022, 5, 23, 15, 45, 57, 123)
 4 
 5 print('The original timestamp object :')
 6 print(timestamp)
 7 
 8 res = timestamp.day_name()
 9 print('A day name on Timestamp object :')
 10 print(res)
In the above example, a day_name() function is called by passing a datetime value. A day_name() function is called that returns day name based on specified Timestamp object. The result is assign to the variable that will be printed on console.
Output
 1 The original timestamp object :
 2 2022-05-23 15:45:57.000123
 3 
 4 A day name on Timestamp object :
 5 Monday

Example 2

Example 2
 1 import pandas as pd
 2 
 3 timestamp = pd.Timestamp(2023, 11, 23, 22, 55, 14, 110001, tz = 'Europe/Berlin')
 4 
 5 print('A timestamp object : ')
 6 print(timestamp)
 7 
 8 res = timestamp.day_name()
 9 print('A day name on Timestamp object :')
 10 print(res)
In the above example, a day_name() function is called by passing a datetime value. A day_name() function is called that returns day name based on specified Timestamp object. The result is assign to the variable that will be print.
Output
 1 A timestamp object : 
 2 2023-11-23 22:55:14.110001+01:00
 3 
 4 A day name on Timestamp object :
 5 Thursday
Privacy Policy
Terms of Service
Disclaimer
Contact us
About us