I have a data set, with a ‘Year’ column, a ‘Period’ Column, in addition to other columns with different features. Unfortunaterly, the yearly data is broken up into the following periods, in the ‘Period’ column: ‘JAN THRU MAR’, ‘APR THRU JUN’, ‘JUL THRU SEP’, ‘OCT THRU DEC’.
I want to have the ‘Periods’ combined, to have data for the whole year. How can I do this in python pandas?
I started a function, and I’m stuck…
months = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
start_mo, end_mo = period.split('THRU')
start_date = f'{start_month} {Year}'
end_date = f'{end_month} {Year}'```
New contributor
Marta Fuentes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.