How do I convert a daily dataset to a monthly download in Python?

To change the frequency at which your data is sampled, do this:

data = quandl.get("NSE/OIL", collapse="monthly") 		 
# collapse can be "daily" or "weekly" or "monthly" or "quarterly" or "annual"
The above call, if applied to a daily or weekly dataset, will return end-of-month values for that dataset.  It will not affect a quarterly or annual dataset.
Note that the values returned are strictly those from the last observation date for that month.  So if you are looking at an OHLC dataset (eg. stock prices), the "monthly" observations will show the Open, High, Low and Close values  on the last day of the month.  

Still need help? Contact Us Contact Us