Features.setNames

Features.setNames(assignments, oldIdentifiers=None, *, useLog=None)

Set or rename one or more feature names of this object.

Set the feature names of this object according to the values specified by the assignments parameter. If the number of new feature names being passed as assignments is less than the number of features in the object, then the oldIdentifiers argument must be passed with the corresponding previous feature names that are to be changed. If assignments is None, then all feature names will be given new default values.

Parameters:
  • assignments (str, iterable, dict, None) –

    • str - A string not currently in the featureName set.

    • iterable - Given a list-like container, the mapping between names and array indices will be used to define the feature names.

    • dict - The mapping for each feature name in the format {name:index}

    • None - remove names from this object.

  • oldIdentifiers (str, int, iterable, None) –

    • str - The name of a feature to be renamed.

    • int - The index of a feature to be renamed.

    • iterable - The names or indices of features to be renamed.

    • None - The default when assigning names to all features in the data.

  • useLog (bool, None) – Local control for whether to send object creation to the logger. If None (default), use the value as specified in the “logger” “enabledByDefault” configuration option. If True, send to the logger regardless of the global option. If False, do NOT send to the logger, regardless of the global option.

See also

getName, getNames

Examples

>>> X = nimble.identity(4, featureNames=['a', 'b', 'c', 'd'])
>>> X.features.setNames(['1', '2', '3', '4'])
>>> X.features.getNames()
['1', '2', '3', '4']
>>> X.features.setNames(['newer', 'sea'], oldIdentifiers=['1', '3'])
>>> X.features.getNames()
['newer', '2', 'sea', '4']
>>> X.features.setNames('by', oldIdentifiers='2')
>>> X.features.getNames()
['newer', 'by', 'sea', '4']

Keywords: columns, titles, headers, headings, attributes, identifiers