CouncilDataProject / cdptools_v2

Tools you can use to interact with and run Council Data Project instances.
Other
7 stars 9 forks source link

Add `Database.select_rows_as_dict` and `Database.select_rows_as_dataframe` functions #65

Closed evamaxfield closed 5 years ago

evamaxfield commented 5 years ago

Add two new functions to the Database ABC and all children that allow for the return of data as dictionary or as dataframe:

Dictionary Example:

db.select_rows_as_dict("event")
# returns
# {
#    "abcd": {"created": ...}
#    "efgh": {"created": ...}
# }

DataFrame Example:

db.select_rows_as_dataframe("event")
# returns
# <pandas.core.frame.DataFrame>