![]() |
VOOZH | about |
The dt.tz_convert() method converts tz-aware DateTime Series object from one time zone to another.
Output:
Syntax: Series.dt.tz_convert(tz)
Parameter
- tz: Time zone to convert timestamps to.
Returns: series of same type as input
To convert timezones from one timezone to another in a tz-aware DateTime Series we use the dt.tz_convert method of the Pandas library in Python.
Let us understand it better with an example:
Use the Series.dt.tz_convert() function to convert the timezone of the timestamps in the given series object.
Output :
Now we will use the dt.tz_convert() function to convert the timestamps in the given series object to 'Asia/Calcutta'.
Output :
As we can see in the output, the dt.tz_convert() function has successfully converted the timezone of the timestamps in the given series object to the target timezone.