The day_name()
function in pandas returns the day name of a given Timestamp
object. This is equivalent to Python's datetime
object.
Timestamp.day_name()
locale
: This function takes a single optional parameter value, locale
. This is the locale that determines the language in which the day name is returned. By default, it takes the English locale
.str
: The day_name()
function returns a string that indicates the day name.# A code to illustrate the day_name() function in Pandas# Importing the pandas libraryimport pandas as pd# Creating a Timestamp objectmy_date = pd.Timestamp('2022-04-29T7:48:52.192548651')# Obtaining the day name from the Timestamp objectname = my_date.day_name()print("The day from the given date is: ", name)
pandas
module.Timestamp
object and name it my_date
.Timestamp
object (my_date
) by using the day_name()
function. The result is assigned to the variable name
variable.name
variable.