change freq of date index in pandas

#Change freq of df DateTimeIndex into a monthly freq
df.asfreq('M')

Here is what the above code is Doing:
1. The asfreq() method is used to change the frequency of the DateTimeIndex.
2. The ‘M’ argument is used to change the frequency to monthly.
3. The method returns a new DataFrame with the monthly frequency.