Data manipulation tools for python.
This is a collection of various submodules and useful functions for manipulating some (what I've found to be) common data structures in python.
- ddict : dotted-dictionary class and operations
- grouping : data grouping routines
- mongo : pymongo-related functions
- np : numpy-related functions
- qfilter : list-of-dicts filtering with a mongo query syntax
- listify : make something a list (if it isn't already)
- plot : matplotlib-related functions
- rmap : data remapping
see ddict/README
see grouping/README
see mongo/README
see np/README
see qfilter/README
Take an item, make it into a list.
from datautils import listify
listify(1) == [1, ]
listify(1, n=2) == [1, 1]
listify([1, ]) == [1, ]
listify('a') == ['a, ]
Wrap matplotlib (pylab) plotting functions to accept:
- list of dicts (like mongo document lists)
- dicts of [dicts of] lists (i.e. groupings)
the basic structure of each plotting call is:
plot(documents, mapping, **kwargs)
for mapping details see rmap
Remapping from list of dicts (or dicts of lists) to dicts of lists.
Types of mappings:
- simple: b = a
- function: b = f(a)
- query: b = qf(a, q) [see qfilter, or mongo queries]