Groupby in Python¶
This chapter takes a look at how groupby can be realized in python.
shmakovpn_tools/shmakovpn/tests/group_by/test_group_by.py
Python groupby examnples.
Author: shmakovpn <shmakovpn@yandex.ru>
Date: 2020-09-30
- class tests.group_by.test_group_by.TestGroupBy(methodName='runTest')[source]¶
This class contains tests of different variants of groupby
- data2: List[Dict[str, Any]] = [{'name': 'alex', 'score': 2}, {'name': 'john', 'score': 4}, {'name': 'dan', 'score': 1}, {'name': 'alex', 'score': 6}, {'name': 'dan', 'score': 3}]¶
the dataset for tests
- test_group_by_declarative() → None[source]¶
The simple groupby realization using a declarative approach
- test_group_by_declarative2() → None[source]¶
The simple groupby realization using a declarative approach
- test_group_by_declarative3() → None[source]¶
The simple groupby realization using a declarative approach
- test_group_by_functional1() → None[source]¶
The simple groupby realization using a functional approach
- test_group_by_functional2() → None[source]¶
The simple groupby realization using a functional approach
- test_group_by_itertools_sorted() → None[source]¶
Tests itertools.groupby on sorted dataset.
This test figures out that itertools.groupby really works on the sorted dataset