Skip to content

Commit

Permalink
Fix ME to M and doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
Claire Donnelly authored and ClaireDons committed Mar 11, 2024
1 parent 589f740 commit 81683f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion lilio/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ def resample(
) -> pd.DataFrame: ...


# ruff: noqa: E501 / Ignoring line length issue until pd.Interval fixed to drop time.
def resample(
calendar: Calendar,
input_data: Union[pd.Series, pd.DataFrame, xr.DataArray, xr.Dataset],
Expand Down
5 changes: 2 additions & 3 deletions lilio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,11 @@ def infer_input_data_freq(
if data_freq is None: # Manually infer the frequency
data_freq = (data.time.values[1:] - data.time.values[:-1]).min()

if "ME" or "MS" in data_freq:
data_freq = data_freq.replace("ME", "M").replace("MS", "M")

if isinstance(data_freq, str):
data_freq.replace("-", "") # Get the absolute frequency

data_freq = data_freq.replace("ME", "M").replace("MS", "M")

if not re.match(r"\d+\D", data_freq): # infer_freq can return "d" for "1d".
data_freq = "1" + data_freq

Expand Down

0 comments on commit 81683f9

Please sign in to comment.