File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1289,6 +1289,35 @@ cdef class _Period(object):
1289
1289
1290
1290
@property
1291
1291
def days_in_month (self ):
1292
+ """
1293
+ Get the total number of days in the month that this period falls on.
1294
+
1295
+ Returns
1296
+ -------
1297
+ int
1298
+
1299
+ See Also
1300
+ --------
1301
+ Period.daysinmonth : Gets the number of days in the month.
1302
+ DatetimeIndex.daysinmonth : Gets the number of days in the month.
1303
+ calendar.monthrange : Returns a tuple containing weekday
1304
+ (0-6 ~ Mon-Sun) and number of days (28-31).
1305
+
1306
+ Examples
1307
+ --------
1308
+ >>> p = pd.Period('2018-2-17')
1309
+ >>> p.days_in_month
1310
+ 28
1311
+
1312
+ >>> pd.Period('2018-03-01').days_in_month
1313
+ 31
1314
+
1315
+ Handles the leap year case as well:
1316
+
1317
+ >>> p = pd.Period('2016-2-17')
1318
+ >>> p.days_in_month
1319
+ 29
1320
+ """
1292
1321
base, mult = get_freq_code(self .freq)
1293
1322
return pdays_in_month(self .ordinal, base)
1294
1323
You can’t perform that action at this time.
0 commit comments