Using ABCD from Python - RSE-Cambridge/abcd GitHub Wiki

ABCD can be used from within python to extract data for further analysis. For example:

$ python
Python 3.7.0 (default, Jul 15 2018, 10:44:58)
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from abcd import ABCD
>>> abcd = ABCD(db="postgresql://localhost")
>>> abcd.count()
52349

Much of the same command syntax carries over from the command line interface, where the first verb translates to the function name:

>>> abcd.select('total_energy')
[big dataframe]
>>> abcd.select('total_energy where total_energy > -15')
[smaller dataframe]

and the select command (and most other commands) return results in the form of a pandas dataframe.