From ea8174f807c87062cc3aff10947a2a13035b8f2f Mon Sep 17 00:00:00 2001 From: Jeff Newman Date: Mon, 28 Oct 2024 17:36:29 -0500 Subject: [PATCH] numexpr dims --- sharrow/relationships.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sharrow/relationships.py b/sharrow/relationships.py index 49ff18b..b42126e 100644 --- a/sharrow/relationships.py +++ b/sharrow/relationships.py @@ -964,6 +964,13 @@ def get_expr( else: if dtype is not None: result = result.astype(dtype) + # numexpr doesn't carry over the dimension names or coords + result = result.rename( + {result.dims[i]: self.root_dims[i] for i in range(result.ndim)} + ) + if with_coords: + result = result.assign_coords(self.root_dataset.coords) + elif engine == "pandas-numexpr": from xarray import DataArray