![]() |
VOOZH | about |
The dt.weekofyear attribute returns a Series containing the week ordinal of the year in the underlying data of the given series object.
Output:
Syntax: Series.dt.weekofyear
Parameter: None
Returns: Series containing the week ordinal
To extract the week of the year from the date in the Pandas Series we use the dt.weekofyear attribute of the Pandas library in Python.
Let us understand it better with an example:
Use the Series.dt.weekofyear 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.weekofyear attribute to return the week ordinal of the year in the underlying data of the given Series object.
Output :
As we can see in the output, the Series.dt.weekofyear attribute has successfully accessed and returned the week ordinal of the year in the underlying data of the given series object.