Skip to content

Commit a836b52

Browse files
authored
Merge pull request #29 from kthyng/tweak
relaxed condition to pass through existing keys
2 parents 13b52a2 + fc1ed40 commit a836b52

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cf_pandas/accessor.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ def __getitem__(self, key: str) -> Union[pd.Series, pd.DataFrame]:
107107

108108
# if key is a coordinate or axes, use a different method to match
109109
valid_keys = _COORD_NAMES + _AXIS_NAMES
110-
if key in valid_keys:
110+
# return the key if it is already a name in the object and doesn't need to be interpreted
111+
if key in self._obj.keys():
112+
col_names = [key]
113+
114+
elif key in valid_keys:
111115
col_names = _get_axis_coord(self._obj, key)
112116

113117
else:

0 commit comments

Comments
 (0)