quandl/Python — pull request #3 by jlowin (2013-04-17 18:41:16+00:00)
Title: Sort dates ascending for compatibility with Pandas timeseries conventions

Quandl.com uses a descending convention for sorting dates (newest information at the top). However, Pandas uses an ascending convention. Therefore, with data imported via the current function, Pandas timeseries methods like `data.diff()`, `data.pct_change()`, or `data.shift()` give unexpected results (looking forward in time, rather than back) and advanced timeseries indexing like `data.ix['Nov 2010' : 'May 2011']` fails with an error.

This PR sorts imported data in ascending order by default in order to keep compatibility with Pandas, but lets users revert to descending order by passing `ascending=False`. This way equivalency can be maintained with manually downloaded datasets (that are in descending order).

Please note that this is a very small PR -- only 5 lines of functionality in the first commit. The second commit makes a number of minor PEP8/formatting fixes that clean up the code but add no functionality. However, it touches many lines, making this appear like a much larger PR than it actually is.