xarray.Index.create_variables#
- Index.create_variables(variables=None)[source]#
Maybe create new coordinate variables from this index.
This method is useful if the index data can be reused as coordinate variable data. It is often the case when the underlying index structure has an array-like interface, like
pandas.Index
objects.The variables given as argument (if any) are either returned as-is (default behavior) or can be used to copy their metadata (attributes and encoding) into the new returned coordinate variables.
Note: the input variables may or may not have been filtered for this index.
- Parameters:
variables (dict-like, optional) – Mapping of
Variable
objects.- Returns:
index_variables (dict-like) – Dictionary of
Variable
orIndexVariable
objects.