How do I convert a daily time-series to a monthly download in Python?
Note that data on Nasdaq Data Link comes in two formats: time-series and tables. You can learn more about these formats here.
To change the sample frequency of a daily time-series to monthly, please use the collapse= parameter, like so:
data = quandl.get("XNAS/ACIW", collapse="monthly")
Collapse can be "daily","weekly", "monthly", "quarterly" or "annual".
Note that the conversion process is very simple:
Nasdaq Data Link simply takes the last observation in the day/month/week/quarter/year and uses that as the daily/monthly/weekly/quarterly/annual datum.
This simple conversion process does not work well for time-series that contain percentage changes, period averages/totals (e.g. trading volume) or period extremes (e.g. high/low or OHLC for security prices). For such time-series, we recommend downloading the raw data and carrying out the required daily to monthly transformation using your own analytics tool.
Note also that you can only convert a time-series to a less granular frequency (e.g. daily to monthly) and never the other way around to a more granular frequency (e.g. annual to daily).
There is no collapse parameter for data in tables format. For tables, we recommend downloading the raw data and carrying out the required daily to monthly transformation using your own analytics tool.