dictutils.pivotΒΆ
- dictutils.pivot(d, order)[source]ΒΆ
Pivot a nested dictionary by rearranging the key levels according to order.
- Parameters:
- Return type:
- Returns:
Pivoted dictionary with keys rearranged
Example
d = {βAβ: {βXβ: 1, βYβ: 2}, βBβ: {βXβ: 3, βYβ: 4}} pivot(d, [1, 0]) -> {βXβ: {βAβ: 1, βBβ: 3}, βYβ: {βAβ: 2, βBβ: 4}}