Python "pandas FutureWarning treated as error" in CI
pandas emits FutureWarning for APIs scheduled to change. With filterwarnings = error, pytest turns that warning into a failure, so an upgraded pandas can break previously-green tests without any code change.
What this error means
A test fails with "FutureWarning: ... is deprecated and will be removed in a future version. Use ... instead." raised as an error from a pandas call.
pytest
FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.Common causes
A deprecated pandas API in use
Code calls a method or pattern pandas has marked for removal, so it warns.
A pandas upgrade newly emitting the warning
A version bump added the FutureWarning to an API that was silent before.
How to fix it
Migrate to the recommended API
- Read the warning to find the replacement API and update the call.
- If a migration is blocked, scope a targeted filterwarnings ignore for that specific warning rather than disabling all.
- Pin pandas if you need to defer the migration deliberately.
Python
# replace deprecated applymap with map
result = df.map(func)How to prevent it
- Keep up with pandas deprecations as you upgrade.
- Scope warning ignores narrowly, never globally.
- Pin pandas to control when new warnings appear.
Related guides
Python "pytest.PytestUnraisableExceptionWarning" in CIFix "pytest.PytestUnraisableExceptionWarning" in CI - an exception was raised in a __del__ or weakref callbac…
Python "matplotlib: no display, needs Agg backend" in CIFix matplotlib failing for lack of a display in CI - a GUI backend cannot open on a headless runner, so plott…
pandas "SettingWithCopyWarning" Failing CI as an ErrorFix pandas "SettingWithCopyWarning: A value is trying to be set on a copy of a slice" failing CI - when warni…