Wrapper classes around multidimensional numpy matrices for (dis)aggregation of data.
Project description
Data (dis)aggregation
Install
pip install data-disaggregation
Quickstart
from data_disaggregation import Dimension, Variable
# create dimension hierarchies
time = Dimension("time")
hour = time.add_level("hour", [1, 2, 3])
space = Dimension("space")
region = space.add_level("region", ["r1", "r2"])
subregion = region.add_level(
"subregion", {"r1": ["sr1_1", "sr1_2"], "r2": ["sr2_1"]}
)
# create extensive variable
v1 = Variable(
name="v1",
data={
(1, "sr1_1"): 2,
(1, "sr1_2"): 3,
(2, "sr1_2"): 4,
(2, "sr2_1"): 5,
},
domain=[hour, subregion],
vartype="extensive",
)
# transform (aggregate) fo target dimension
v2 = v1.transform(domain=[region])
# print as pandas series
print(v2.to_series())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
data-disaggregation-0.1.2.tar.gz
(44.2 kB
view hashes)
Close
Hashes for data-disaggregation-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d43bb8b4d9dd14d6b58966b45db1e0b5eb5bcdee60ce854560b6517b1f73c4e |
|
MD5 | 151412cf59e7662ebc4ee9046a0dd9eb |
|
BLAKE2b-256 | b4a211a5310e9c428fa3d89a1ddc8815585cb7c4c1f8ecb6b123202d12048c4b |