Python | Pandas Timestamp.dst
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.
# importing pandas as pd import pandas as pd # Create the Timestamp object ts = pd.Timestamp('2015-03-31 15:47:25.901597', tz = 'US/Eastern') # Print the Timestamp object print(ts) |
Output :

Now we will use the Timestamp.dst() function to find the dst of the given object.
# return the dst ts.dst() |
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.
# importing pandas as pd import pandas as pd # Create the Timestamp object ts = pd.Timestamp(year = 2009, month = 5, day = 31, hour = 4, second = 49, tz = 'Europe/Berlin') # Print the Timestamp object print(ts) |
Output :

Now we will use the Timestamp.dst() function to find the dst of the given object.
# return the dst ts.dst() |
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.
Recommended Posts:
- Python | pandas.map()
- Python | Pandas Series.str.pad()
- Python | Pandas dataframe.mad()
- Python | Pandas.factorize()
- Python | Pandas Panel.sub()
- Python | Pandas Series.str.len()
- Python | Pandas Series.std()
- Python | Pandas dataframe.max()
- Python | Pandas PeriodIndex.day
- Python | Pandas.melt()
- Python | Pandas Series.mod()
- Python | Pandas dataframe.mean()
- Python | Pandas Series.agg()
- Python | Pandas Series.dt.second
- Python | Pandas dataframe.div()
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



