Skip to content

cleanup API for methods changing/dropping Array labels/values vs labels in Axis/AxisCollection #783

Open

Description

@gdementen

Functions to change labels and values are inconsistent for LArray, Axis and AxisCollection.

e.g. Array.set_labels can accept both a mapping and functions, but the same functionality is split in two functions for values: apply and apply_map; the functions do not have cohesive names, etc.

Array.apply_map and Axis.replace/Array.set_labels/AxisCollection.set_labels

All these functions provide some way to replace some values by some other values on their respective level. We should:

  1. find cohesive names for the functions. For examples:

    • Array.replace_labels, Array.replace_values, Axis.replace_labels, AxisCollection.replace_labels
      or

    • Array.change_labels, Array.change_values, Axis.change_labels, AxisCollection.change_labels
      or

    • Array.set_labels, Array.set_values, Axis.set_labels, AxisCollection.set_labels,
      (Array.replace_values/change_values/set_values) would replace both Array.apply and Array.apply_map

    • Array.drop_labels, Array.drop_values, Axis.drop_labels, AxisCollection.drop_labels

    • Array.sort_labels, Array.sort_values, Axis.sort_labels, AxisCollection.sort_labels

    • Array.insert, Axis.insert, AxisCollection.insert_labels, AxisCollection.insert_axes
      or

    • Array.insert_labels??? (inserts both labels & values), Axis.insert_labels, AxisCollection.insert_labels

    • Array.append (appends both label & value), Axis.append, AxisCollection.append_labels, AxisCollection.append_axis

    • Array.combine_axes, Array.split_axes
      or

    • Array.combine_axes, Array.split_labels, Array.chunks, Axis.chunks (see implement Axis.chunks & LArray.chunks #505)

  2. make sure the arguments & functionality are as close as possible.

Activity

  1. changed the title [-]synchronize LArray.apply_map and Axis.replace/LArray.set_labels/AxisCollection.set_labels[/-] [+]cleanup API for LArray vs Axis/AxisCollection[/+] on Jun 24, 2019
  2. changed the title [-]cleanup API for LArray vs Axis/AxisCollection[/-] [+]cleanup API for methods changing LArray labels/values vs labels in Axis/AxisCollection[/+] on Jun 24, 2019
  3. added this to the 0.31 milestone on Jun 24, 2019
  4. removed this from the 0.31 milestone on Aug 1, 2019
  5. added this to the nice_to_have milestone on Oct 10, 2019
  6. changed the title [-]cleanup API for methods changing LArray labels/values vs labels in Axis/AxisCollection[/-] [+]cleanup API for methods changing/dropping Array labels/values vs labels in Axis/AxisCollection[/+] on Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions