Skip to content

[RTADPA BW Tests] Fix pandas FutureWarnings in bandwidth scripts

LCG106c introduces these FutureWarnings:

/home/lblocal/lhcb-ci/workspace/lhcb-pr-test/data/build/Moore/Hlt/Hlt2Conf/python/Hlt2Conf/tests/bandwidth/line_descriptives.py:56: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!
/home/lblocal/lhcb-ci/workspace/lhcb-pr-test/data/build/Moore/Hlt/Hlt2Conf/python/Hlt2Conf/tests/bandwidth/calculate_stream_overlap.py:53: FutureWarning: ChainedAssignmentError: behaviour will change in pandas 3.0!
/home/lblocal/lhcb-ci/workspace/lhcb-pr-test/data/build/Moore/Hlt/Hlt2Conf/python/Hlt2Conf/tests/bandwidth/combine_rate_output.py:123: FutureWarning: Styler.applymap has been deprecated. Use Styler.map instead.
/home/lblocal/lhcb-ci/workspace/lhcb-pr-test/data/build/Moore/Hlt/Hlt2Conf/python/Hlt2Conf/tests/bandwidth/combine_rate_output.py:119: FutureWarning: Styler.applymap has been deprecated. Use Styler.map instead.

For ChainedAssignmentError, Pandas docs say

When the mode.copy_on_write option is enabled, chained assignment can never work. In such a situation, we are always setting into a temporary object that is the result of an indexing operation (getitem), which under Copy-on-Write always behaves as a copy. Thus, assigning through a chain can never update the original Series or DataFrame.

This can likely be mitigated with df.loc

Edited by Luke Grazette