79091804

Date: 2024-10-15 21:30:55
Score: 1.5
Natty:
Report link

This error happened because of duplicate indices in your data frame. What you can do is setting index. for instance you can do it for the 'Date Enrolled' column.

tdf.set_index('Date Enrolled', inplace=True)

later you can shift by 1 for the month. tdf['previous_month'] = tdf['monthly_sum'].shift(1)

also by 12 for the year.

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: Dian