I have created a dataframe called date as follows, but I am not able to call that dataframe by typing date in further cells. I need to call that dataframe as a table and add new column to it.
Right now, this is what I have:
date = data.groupby(pd.to_datetime(data['Completion Date'], format='%d.%m.%Y').dt.month)['Learning Hours'].sum()
date.index = pd.to_datetime(date.index, format='%m').month_name().str[:3]
date.rename_axis('Month').reset_index(name='Learning hours')
O/P:
Month Learning hours
Jan 349.5
Feb 417.0
I need to add a new column to this table called Required, with values 430 in all rows as shown in the below:
needed O/P:
Month Learning hours Required
Jan 349.5 430
Feb 417.0 430