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.3.tar.gz
(22.6 kB
view hashes)
Close
Hashes for data-disaggregation-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5a107ad17ec55139752191dc0569ff6cde5456518db6a226ebe64a6f649f316 |
|
MD5 | e8a99d3e3df669626b6b8a018fb1e262 |
|
BLAKE2b-256 | cbbf42a12a9e69f216125bf95112b7666f14738e4a8761e4cd43256c2ca9e60f |