Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

LOD_YMV

lod_ymv_transposition

Help on function lod_ymv_transposition in module pydicts.lod_ymv:

lod_ymv_transposition(ld, key_year='year', key_month='month', key_value='value')
    Covert lod_ymv into a trasposition form
    +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------+
    |   year |     m1 |     m2 |     m3 |     m4 |     m5 |     m6 |     m7 |     m8 |     m9 |    m10 |    m11 |    m12 |   total |
    |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------|
    |   2020 |  82.92 |  67.41 |  51.24 |  61.98 |  65.21 |  66.69 |  70.55 |  81.31 |  76.6  |  74.33 |  85.59 |  89.84 |  873.67 |
    |   2021 |  90.52 |  96.19 | 106.42 | 114.54 | 113.42 | 122.66 | 128.38 | 137.18 | 128.82 | 143.94 | 147.06 | 159.98 | 1489.11 |
    |   2022 | 139.62 | 134    | 148.32 | 131.9  | 122.38 | 104.96 | 125.88 | 120.36 | 103.98 | 114.4  | 113.64 | 102.12 | 1461.56 |
    |   2023 | 111.62 | 110.42 | 112.76 | 113.96 |   0    |   0    |   0    |   0    |   0    |   0    |   0    |   0    |  448.76 |
    +--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+---------+

lod_ymv_transposition_with_percentages

Help on function lod_ymv_transposition_with_percentages in module pydicts.lod_ymv:

lod_ymv_transposition_with_percentages(lod_ymv_transposition)
    Replace a lod_ymv_transposition values to Percentages

lod_ymv_transposition_sum

Help on function lod_ymv_transposition_sum in module pydicts.lod_ymv:

lod_ymv_transposition_sum(lymv_a, lymv_b)
    Sums to lod_ymv_transpositions

lod_ymv_filling

Help on function lod_ymv_filling in module pydicts.lod_ymv:

lod_ymv_filling(
    lod,
    year_from,
    year_to=2026,
    fill_value=0,
    key_year='year',
    key_month='month',
    key_value='value'
)
    Fills missing year-month entries in a list of dictionaries with a specified fill_value.

    This function is useful for creating a complete time series from sparse data.

    Args:
        lod (list): The input list of dictionaries, each expected to have year, month, and value keys.
        year_from (int): The starting year for the filling process.
        year_to (int, optional): The ending year for the filling process. Defaults to the current year.
        fill_value (int or float, optional): The value to use for missing entries. Defaults to 0.
        key_year (str, optional): The key for the year in the input dictionaries. Defaults to "year".
        key_month (str, optional): The key for the month in the input dictionaries. Defaults to "month".
        key_value (str, optional): The key for the value in the input dictionaries. Defaults to "value".

    Returns:
        list: A new list of dictionaries with all year-month combinations from `year_from` to `year_to`
              (inclusive), filled with `fill_value` where original data was missing. Existing entries
              retain their original values and any other keys. The list is sorted by year and month.