Change language

Python | Pandas Timestamp.weekday_name

| |

The Pandas attribute Timestamp.weekday_name returns the day of the week for a given date in a Timestamp object.

Syntax: Timestamp.weekday_name

Parameters: None

Return: name of the week day

Example # 1: Use the Timestamp.weekday_name attribute to find the day of the week name for a given date in a Timestamp object.

# import pandas as pd

import pandas as pd

 
# Create Timestamp object

ts = pd.Timestamp (year = 2011 , month = 11 , day = 21

hour = 10 , second = 49 , tz = ’US / Central’ )

 
# Print Timestamp object

print (ts)

Output:

We will now use the Timestamp.weekday_name attribute to find the name of the day of the week.

# return the name of the day of the week
ts.weekday_name

Output:

As we can see from the output, the Timestamp.weekday_name attribute returned "Monday", which indicates that the date in this Timestamp is — Monday.

Example # 2: Use the Timestamp.weekday_name attribute to find the name of the day of the week for a given date in a Timestamp object.

# import pandas as pd

import pandas as pd

 
# Create object Timestamp

ts = pd.Timestamp ( year = 2009 , month = 5 , day = 31 ,

hour = 4 , second = 49 , tz = ’ Europe / Berlin’ )

 
# Print the Timestamp object

print (ts)

Output:

We will now use the Timestamp.weekday_name attribute to find the name of the day of the week.

# return the name of the day of the week
ts.weekday_name

Output:

Like us we can see in the output that the Timestamp.weekday_name attribute returned & # 39; Sunday & # 39;, indicating that the date in this Timestamp object is & # 39; Sunday & # 39 ;.

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

News

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method