![]() |
VOOZH | about |
Pandas dt.week attribute returns a NumPy array containing the week ordinal of the year in the underlying data of the given DateTime Series object.
Output
Syntax: Series.dt.week
Parameter : None
Returns: NumPy array containing week values
To extract the week value from the DateTime series we use the Series.dt.week attribute of the Pandas library in Python.
Let us understand it better with an example:
Use the Series.dt.week attribute to return the week ordinal of the year in the underlying data of the given Series object.
Output :
Now we will use the Series.dt.week attribute to return the week ordinal of the year in the underlying data of the given Series object.
Output :
👁 week ordinals of given timestamps
As we can see in the output, the Series.dt.week attribute has successfully accessed and returned the week ordinal of the year in the underlying data of the given series object.