Skip to content

Commit

Permalink
MNT: filter irrelevant warning about silent downcasting
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Feb 4, 2024
1 parent 1de8383 commit f1a931e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
27 changes: 24 additions & 3 deletions fastf1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,19 @@ def merge_channels(
.interpolate(method=method, **interp_kwargs)

elif sig_type == 'discrete':
res = merged.loc[:, ch].resample(frq, origin=ref_date) \
.ffill().ffill().bfill()
with warnings.catch_warnings():
# deprecated since pandas 2.2.0; don't opt in to new
# behaviour as that would silently change behaviour for
# user code; irrelevant here, therefore just filter
warnings.filterwarnings(
"ignore",
"Downcasting object dtype arrays on .fillna, "
".ffill, .bfill is deprecated",
FutureWarning
)
res = merged.loc[:, ch] \
.resample(frq, origin=ref_date) \
.ffill().ffill().bfill()
# first ffill is a method of the resampler object and will
# ONLY ffill values created during resampling but not
# already existing NaN values. NaN values already existed
Expand Down Expand Up @@ -659,7 +670,17 @@ def fill_missing(self):
.interpolate(method=method, **interp_kwargs)

elif sig_type == 'discrete':
ret.loc[:, ch] = ret.loc[:, ch].ffill().ffill().bfill()
with warnings.catch_warnings():
# deprecated since pandas 2.2.0; don't opt in to new
# behaviour as that would silently change behaviour for
# user code; irrelevant here, therefore just filter
warnings.filterwarnings(
"ignore",
"Downcasting object dtype arrays on .fillna, "
".ffill, .bfill is deprecated",
FutureWarning
)
ret.loc[:, ch] = ret.loc[:, ch].ffill().ffill().bfill()
# first ffill is a method of the resampler object and will
# ONLY ffill values created during resampling but not already
# existing NaN values. NaN values already existed because of
Expand Down
2 changes: 0 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,3 @@ filterwarnings =
ignore:(?s).*Pyarrow will become a required dependency of pandas.*:DeprecationWarning
# TODO: temp, should be resolved with pandas 2.2.1
ignore:Passing a (Single)?BlockManager to.*:DeprecationWarning
# TODO: temp, needs to be actually fixed before pandas 3.0.0
ignore:Downcasting object dtype arrays.*:FutureWarning

0 comments on commit f1a931e

Please sign in to comment.