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 :py:class:`pandas.Index` objects. The
(
self, variables: Mapping[Any, Variable] | None = None
)
| 170 | raise NotImplementedError() |
| 171 | |
| 172 | def create_variables( |
| 173 | self, variables: Mapping[Any, Variable] | None = None |
| 174 | ) -> IndexVars: |
| 175 | """Maybe create new coordinate variables from this index. |
| 176 | |
| 177 | This method is useful if the index data can be reused as coordinate |
| 178 | variable data. It is often the case when the underlying index structure |
| 179 | has an array-like interface, like :py:class:`pandas.Index` objects. |
| 180 | |
| 181 | The variables given as argument (if any) are either returned as-is |
| 182 | (default behavior) or can be used to copy their metadata (attributes and |
| 183 | encoding) into the new returned coordinate variables. |
| 184 | |
| 185 | Note: the input variables may or may not have been filtered for this |
| 186 | index. |
| 187 | |
| 188 | Parameters |
| 189 | ---------- |
| 190 | variables : dict-like, optional |
| 191 | Mapping of :py:class:`Variable` objects. |
| 192 | |
| 193 | Returns |
| 194 | ------- |
| 195 | index_variables : dict-like |
| 196 | Dictionary of :py:class:`Variable` or :py:class:`IndexVariable` |
| 197 | objects. |
| 198 | """ |
| 199 | if variables is not None: |
| 200 | # pass through |
| 201 | return dict(**variables) |
| 202 | else: |
| 203 | return {} |
| 204 | |
| 205 | def should_add_coord_to_array( |
| 206 | self, |
no outgoing calls
no test coverage detected