I have a data frame with a date time index, and I would like to multiply some columns with the number of days in that month.
TUFNWGTP TEL
import pandas as pd from pandas.tseries.offsets import MonthEnd df['dim'] = (pd.to_datetime(df.index) + MonthEnd(0)).dt.day
You can omit pd.to_datetime(), if your index is already DatetimeIndex.
pd.to_datetime()
DatetimeIndex