I have a dataframe as such:
DF = pd.DataFrame(
{
'Application Date': ['2023-06-03', '2023-05-15', '2022-02-10', '2021-12-30', '2022-09-01'],
'Application ID': ['1', '2', '3', '4', '5']
}
)
DF['Application Date'] = pd.to_datetime(DF['Application Date'], format='%Y-%m-%d')
DF.dtypes
I wish to find the number of applications by year and month for which I used the following piece of code
DF.groupby(
[recruitmentData['Application Date'].dt.year, recruitmentData['Application Date'].dt.month]
).size()
These result has two columns “Application Date”
How can I rename the first column as “Application Year”, second as “Application Month” and last as “No of Applicants”