Python | Pandas Timestamp.dst
Last Updated :
08 Jan, 2019
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas Timestamp.dst()
function return a timedelta object which contains self.tzinfo.dst(self) value. It returns the Daylight Saving Time for the timezone of the given Timestamp object.
Syntax : Timestamp.dst()
Parameters : None
Return : dst
Example #1: Use Timestamp.dst()
function to find the Daylight Saving Time for the given Timestamp object.
import pandas as pd
ts = pd.Timestamp( '2015-03-31 15:47:25.901597' , tz = 'US/Eastern' )
print (ts)
|
Output :
Now we will use the Timestamp.dst()
function to find the dst of the given object.
Output :
As we can see in the output, the Timestamp.dst()
function has returned a timedelta object containing the Daylight Saving Time for the given Timestamp object.
Example #2: Use Timestamp.dst()
function to find the Daylight Saving Time for the given Timestamp object.
import pandas as pd
ts = pd.Timestamp(year = 2009 , month = 5 , day = 31 ,
hour = 4 , second = 49 , tz = 'Europe/Berlin' )
print (ts)
|
Output :
Now we will use the Timestamp.dst()
function to find the dst of the given object.
Output :
As we can see in the output, the Timestamp.dst()
function has returned a timedelta object containing the Daylight Saving Time for the given Timestamp object.
Share your thoughts in the comments
Please Login to comment...