kktk-KO / pytranspose

transpose nested dict and list.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pytranspose

Transpose nested dict and list.

Usage

from pytranspose import transpose
# assume you have time serise data of temperature in variouse city.
#
# a[city][time] -> temperature
#
# now you want to compare temperature in different city at the same time point.
# transpose function meets this requirement.
#
# b = transpose(a, [1, 0])
# b[time][city] -> temperature
# print(a["Tokyo"][2]) -> 28
a = {"Tokyo": [27, 28, 29], "New York": [25, 24, 28]}
# print(b[1]["New York"]) -> 24
b = transpose(a)

License

These codes are licensed under CC0.

About

transpose nested dict and list.

License:Creative Commons Zero v1.0 Universal


Languages

Language:Python 100.0%