pandagg.response module¶
-
class
pandagg.response.
Aggregations
(data, aggs, query, index, client)[source]¶ Bases:
object
-
serialize
(output='tabular', **kwargs)[source]¶ Parameters: - output – output format, one of “raw”, “tree”, “interactive_tree”, “normalized”, “tabular”, “dataframe”
- kwargs – tabular serialization kwargs
Returns:
-
to_tabular
(index_orient=True, grouped_by=None, expand_columns=True, expand_sep='|', normalize=True, with_single_bucket_groups=False)[source]¶ Build tabular view of ES response grouping levels (rows) until ‘grouped_by’ aggregation node included is reached, and using children aggregations of grouping level as values for each of generated groups (columns).
Suppose an aggregation of this shape (A & B bucket aggregations):
A──> B──> C1 ├──> C2 └──> C3
With grouped_by=’B’, breakdown ElasticSearch response (tree structure), into a tabular structure of this shape:
C1 C2 C3 A B wood blue 10 4 0 red 7 5 2 steel blue 1 9 0 red 23 4 2
Parameters: - index_orient – if True, level-key samples are returned as tuples, else in a dictionnary
- grouped_by – name of the aggregation node used as last grouping level
- normalize – if True, normalize columns buckets
Returns: index, index_names, values
-