Summary
src/ceasiompy/smtrain/smtrain.py calls pd.concat(..., copy=False),
which is deprecated in pandas 3.0:
| File |
Line |
src/ceasiompy/smtrain/smtrain.py |
335 pd.concat([level1_df, level2_df], ignore_index=True, copy=False) |
Verified on pandas 3.0.5:
>>> pd.concat([df1, df2], ignore_index=True, copy=False)
Pandas4Warning: The copy keyword is deprecated and will be removed in a
future version. Copy-on-Write is active in pandas since 3.0 which utilizes
a lazy copy mechanism that defers copies until necessary. Use .copy() to
make an eager copy if necessary.
Pandas4Warning is a DeprecationWarning subclass, so it is invisible
by default and does not fail CI — but it fires whenever the
two-fidelity surrogate-model training reaches the final results
concatenation under pandas ≥3.0, and the keyword will be removed in a
future version.
Suggested fix: version-guarded branch
Guard the call on the pandas version — keep copy=False on pandas <3.0
(where it still skips copying intermediate data) and drop it on ≥3.0,
following the pattern used in NVIDIA/cuml#8142:
if PANDAS_VERSION < Version("3.0"):
pd.concat([level1_df, level2_df], ignore_index=True, copy=False)
else:
pd.concat([level1_df, level2_df], ignore_index=True)
with PANDAS_VERSION = Version(pd.__version__) at module level
(packaging is already a transitive dependency of pandas).
This is behaviour-preserving on every pandas version: the copy
keyword never affects the result of concat, only whether input
buffers are copied, and the branch keeps that behaviour exactly as it
was on each side of the boundary. Verified with runtime checks in
isolated venvs:
- pandas 2.3.3 takes the
copy=False branch: identical results to
today's code (ignore_index=True row append), no warning.
- pandas 3.0.5 takes the plain branch: no
Pandas4Warning is emitted,
results identical (the copy keyword is a documented no-op under
Copy-on-Write).
Summary
src/ceasiompy/smtrain/smtrain.pycallspd.concat(..., copy=False),which is deprecated in pandas 3.0:
src/ceasiompy/smtrain/smtrain.pypd.concat([level1_df, level2_df], ignore_index=True, copy=False)Verified on pandas 3.0.5:
Pandas4Warningis aDeprecationWarningsubclass, so it is invisibleby default and does not fail CI — but it fires whenever the
two-fidelity surrogate-model training reaches the final results
concatenation under pandas ≥3.0, and the keyword will be removed in a
future version.
Suggested fix: version-guarded branch
Guard the call on the pandas version — keep
copy=Falseon pandas <3.0(where it still skips copying intermediate data) and drop it on ≥3.0,
following the pattern used in NVIDIA/cuml#8142:
with
PANDAS_VERSION = Version(pd.__version__)at module level(
packagingis already a transitive dependency of pandas).This is behaviour-preserving on every pandas version: the
copykeyword never affects the result of
concat, only whether inputbuffers are copied, and the branch keeps that behaviour exactly as it
was on each side of the boundary. Verified with runtime checks in
isolated venvs:
copy=Falsebranch: identical results totoday's code (
ignore_index=Truerow append), no warning.Pandas4Warningis emitted,results identical (the
copykeyword is a documented no-op underCopy-on-Write).