Skip to content

Assigning values to label coordinates when copying from existing values in add_years, add_regions, add_items #64

@jucordero

Description

@jucordero

Currently, when adding new years, regions or items to a dataarray or dataset, the non-dimension coordinates are not set or copied from the template set by "copy_from". This typically means these values have to be set manually after, which adds a few lines of code.

da = da.fbs.add_items("apples", copy_from="beef")
da["item_type"].loc[{"Item":"apples"}] = "fruit"
da["item_origin"].loc[{"Item":"apples"}] = "plant"

To avoid having to set these manually every time, it would be nice to have the option to pass a dictionary with the new values for selected non-dimension coordinates

coord_dict = {"item_type":"fruit", "item_origin":"plant"}
da = da.fbs.add_items("apples", copy_from="beef", coords=coord_dict)

This would be specially useful with label coordinates including names and / or numerical IDs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions