Skip to content

Commit 39ab8fe

Browse files
authored
Merge pull request #18 from kthyng/main
forgot to bring split into accessor
2 parents 6a79ff3 + 2dbdc55 commit 39ab8fe

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

cf_pandas/accessor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ def __getitem__(self, key: str):
4242
xarray Dataset of the data associated with key
4343
"""
4444

45-
col_name = cfp.match_criteria_key(self._obj.columns.values, key)
45+
col_name = cfp.match_criteria_key(self._obj.columns.values, key, split=True)
4646
return self._obj[col_name]

tests/test_accessor.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ def test_options():
2121

2222
def test_match_criteria_key_accessor():
2323

24-
vals = ["wind_speed", "WIND_SPEED", "wind_speed_status"]
25-
26-
df = pd.DataFrame(columns=["temp", "wind_speed"])
24+
df = pd.DataFrame(
25+
columns=[
26+
"temp",
27+
"wind_speed",
28+
"wind_speed (m/s)",
29+
"WIND_SPEED",
30+
"wind_speed_status",
31+
]
32+
)
2733

2834
# test accessor with set_options criteria
2935
with cfp.set_options(custom_criteria=criteria):
30-
assert df.cf["wind_s"].columns == ["wind_speed"]
36+
assert sorted(df.cf["wind_s"].columns) == ["wind_speed", "wind_speed (m/s)"]

0 commit comments

Comments
 (0)