MCPcopy Index your code
hub / github.com/pydata/xarray / from_variables

Method from_variables

xarray/core/indexes.py:1064–1080  ·  view source on GitHub ↗
(
        cls,
        variables: Mapping[Any, Variable],
        *,
        options: Mapping[str, Any],
    )

Source from the content-addressed store, hash-verified

1062
1063 @classmethod
1064 def from_variables(
1065 cls,
1066 variables: Mapping[Any, Variable],
1067 *,
1068 options: Mapping[str, Any],
1069 ) -> PandasMultiIndex:
1070 _check_dim_compat(variables)
1071 dim = next(iter(variables.values())).dims[0]
1072
1073 index = pd.MultiIndex.from_arrays(
1074 [var.values for var in variables.values()], names=list(variables.keys())
1075 )
1076 index.name = dim
1077 level_coords_dtype = {name: var.dtype for name, var in variables.items()}
1078 obj = cls(index, dim, level_coords_dtype=level_coords_dtype)
1079
1080 return obj
1081
1082 @classmethod
1083 def concat(

Callers

nothing calls this directly

Calls 4

_check_dim_compatFunction · 0.85
keysMethod · 0.80
itemsMethod · 0.80
valuesMethod · 0.45

Tested by

no test coverage detected