Azzera filtri
Azzera filtri

How do I convert monthly data to quarterly using as the value of the quarter the value of the 1st month of each quarter?

27 visualizzazioni (ultimi 30 giorni)
I have a dataset of monthly data on CPI and I want to convert it to quarterly. I tried to use timetable but it didn't work I think.

Risposte (2)

Cris LaPierre
Cris LaPierre il 14 Dic 2020
Not knowing anything about the format of your data, I would suggest using groupsummary. This will allow you to determine how to summarize the monthly data to quarterly data (average, sum, etc). If your data is already in a table or timetable, and your date info is already a datetime, you can use the 'quarter' groupbin.
Perhaps this example can help get you started. The code might be something like this
qtrCPI = groupsummary(mnCPI,"Timestamp","quarter","mean")

Eric Sofen
Eric Sofen il 14 Dic 2020
Another timetable option is to use retime with the 'firstvalue' aggregation method.

Categorie

Scopri di più su Preprocessing Data in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by