(self)
| 200 | PandasIndex.concat(indexes, "x") |
| 201 | |
| 202 | def test_create_variables(self) -> None: |
| 203 | # pandas has only Float64Index but variable dtype should be preserved |
| 204 | data = np.array([1.1, 2.2, 3.3], dtype=np.float32) |
| 205 | pd_idx = pd.Index(data, name="foo") |
| 206 | index = PandasIndex(pd_idx, "x", coord_dtype=data.dtype) |
| 207 | index_vars = { |
| 208 | "foo": IndexVariable( |
| 209 | "x", data, attrs={"unit": "m"}, encoding={"fill_value": 0.0} |
| 210 | ) |
| 211 | } |
| 212 | |
| 213 | actual = index.create_variables(index_vars) |
| 214 | assert_identical(actual["foo"], index_vars["foo"]) |
| 215 | assert actual["foo"].dtype == index_vars["foo"].dtype |
| 216 | assert actual["foo"].dtype == index.coord_dtype |
| 217 | |
| 218 | def test_to_pandas_index(self) -> None: |
| 219 | pd_idx = pd.Index([1, 2, 3], name="foo") |
nothing calls this directly
no test coverage detected