File tree Expand file tree Collapse file tree 5 files changed +12
-5
lines changed Expand file tree Collapse file tree 5 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ from pandas._libs.tslibs.offsets import (
114114 INVALID_FREQ_ERR_MSG,
115115 BDay,
116116)
117+ from pandas.util._decorators import set_module
117118
118119cdef:
119120 enum :
@@ -2830,6 +2831,7 @@ cdef class _Period(PeriodMixin):
28302831 return period_format(self.ordinal , base , fmt )
28312832
28322833
2834+ @set_module("pandas")
28332835class Period(_Period ):
28342836 """
28352837 Represents a period of time.
Original file line number Diff line number Diff line change 11import collections
22import warnings
33
4+ from pandas.util._decorators import set_module
45from pandas.util._exceptions import find_stack_level
56
67cimport cython
@@ -1854,7 +1855,7 @@ cdef class _Timedelta(timedelta):
18541855
18551856# Python front end to C extension type _Timedelta
18561857# This serves as the box for timedelta64
1857-
1858+ @ set_module ( " pandas " )
18581859class Timedelta (_Timedelta ):
18591860 """
18601861 Represents a duration, the difference between two dates or times.
@@ -1916,7 +1917,7 @@ class Timedelta(_Timedelta):
19161917 --------
19171918 Here we initialize Timedelta object with both value and unit
19181919
1919- >>> td = pd.Timedelta(1, "d ")
1920+ >>> td = pd.Timedelta(1, "D ")
19201921 >>> td
19211922 Timedelta('1 days 00:00:00')
19221923
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ import datetime as dt
5050from pandas._libs.tslibs cimport ccalendar
5151from pandas._libs.tslibs.base cimport ABCTimestamp
5252
53+ from pandas.util._decorators import set_module
5354from pandas.util._exceptions import find_stack_level
5455
5556from pandas._libs.tslibs.conversion cimport (
@@ -1648,7 +1649,7 @@ cdef class _Timestamp(ABCTimestamp):
16481649# Python front end to C extension type _Timestamp
16491650# This serves as the box for datetime64
16501651
1651-
1652+ @set_module("pandas")
16521653class Timestamp(_Timestamp):
16531654 """
16541655 Pandas replacement for python datetime.datetime object .
@@ -2926,7 +2927,7 @@ timedelta}, default 'raise'
29262927 --------
29272928 >>> ts = pd.Timestamp(1584226800 , unit = ' s' , tz = ' Europe/Stockholm' )
29282929 >>> ts.tz
2929- < DstTzInfo ' Europe/Stockholm' CET + 1 : 00 : 00 STD >
2930+ zoneinfo.ZoneInfo( key = ' Europe/Stockholm' )
29302931 """
29312932 return self.tzinfo
29322933
Original file line number Diff line number Diff line change @@ -400,3 +400,6 @@ def test_util_in_top_level(self):
400400
401401def test_set_module ():
402402 assert pd .DataFrame .__module__ == "pandas"
403+ assert pd .Period .__module__ == "pandas"
404+ assert pd .Timestamp .__module__ == "pandas"
405+ assert pd .Timedelta .__module__ == "pandas"
Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ def test_maybe_get_tz_invalid_types():
144144 with pytest .raises (TypeError , match = "<class 'module'>" ):
145145 timezones .maybe_get_tz (pytest )
146146
147- msg = "<class 'pandas._libs.tslibs.timestamps. Timestamp'>"
147+ msg = "<class 'pandas.Timestamp'>"
148148 with pytest .raises (TypeError , match = msg ):
149149 timezones .maybe_get_tz (Timestamp ("2021-01-01" , tz = "UTC" ))
150150
You can’t perform that action at this time.
0 commit comments