pandas.Series.dt.days_in_month # 系列.dt。月内天数[来源] # 该月的天数。 例子 >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]) >>> s = pd.to_datetime(s) >>> s 0 2020-01-01 10:00:00+00:00 1 2020-02-01 11:00:00+00:00 dtype: datetime64[ns, UTC] >>> s.dt.daysinmonth 0 31 1 29 dtype: int32