From fc1ed40442a5971c1db072526f6a9137f7c900c3 Mon Sep 17 00:00:00 2001 From: Kristen Thyng Date: Fri, 22 Sep 2023 17:12:01 -0500 Subject: [PATCH] relaxed condition to pass through existing keys --- cf_pandas/accessor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cf_pandas/accessor.py b/cf_pandas/accessor.py index 9c18a4e..7386ff1 100644 --- a/cf_pandas/accessor.py +++ b/cf_pandas/accessor.py @@ -107,7 +107,11 @@ def __getitem__(self, key: str) -> Union[pd.Series, pd.DataFrame]: # if key is a coordinate or axes, use a different method to match valid_keys = _COORD_NAMES + _AXIS_NAMES - if key in valid_keys: + # return the key if it is already a name in the object and doesn't need to be interpreted + if key in self._obj.keys(): + col_names = [key] + + elif key in valid_keys: col_names = _get_axis_coord(self._obj, key) else: