File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2288,9 +2288,14 @@ cdef class _Period(PeriodMixin):
2288
2288
return bool(is_leapyear(self.year ))
2289
2289
2290
2290
@classmethod
2291
- def now(cls , freq = None ):
2291
+ def now(cls , freq ):
2292
2292
"""
2293
2293
Return the period of now's date.
2294
+
2295
+ Parameters
2296
+ ----------
2297
+ freq : str, BaseOffset
2298
+ Frequency to use for the returned period.
2294
2299
"""
2295
2300
return Period(datetime.now(), freq = freq)
2296
2301
Original file line number Diff line number Diff line change 26
26
dateutil_gettz ,
27
27
maybe_get_tz ,
28
28
)
29
+ from pandas .tseries import offsets
29
30
30
31
import pandas as pd
31
32
from pandas import (
@@ -76,6 +77,13 @@ def test_construction(self):
76
77
assert i1 == i2
77
78
assert i1 == i3
78
79
80
+ i1 = Period .now ("D" )
81
+ i2 = Period (datetime .now (), freq = "D" )
82
+ i3 = Period .now (offsets .Day ())
83
+
84
+ assert i1 == i2
85
+ assert i1 == i3
86
+
79
87
i1 = Period ("1982" , freq = "min" )
80
88
i2 = Period ("1982" , freq = "MIN" )
81
89
assert i1 == i2
You can’t perform that action at this time.
0 commit comments