I encountered a FutureWarning while working with liionpack that seems related to a potential future error due to setting an item with an incompatible dtype in netlist_utils.py. The warning suggests that a future version of pandas will raise an error for this operation, specifically when setting values of a dtype incompatible with int64.
Here's the warning message I received:
/home/mlappert/batterypipeline/venv_batterypipeline/lib/python3.11/site-packages/liionpack/
netlist_utils.py:736: FutureWarning: Setting an item of incompatible dtype is deprecated and
will raise an error in a future version of pandas. Value '[2.11290499e-05 2.53498513e-05
9.42634428e-06 1.40860332e-04 1.28029748e-06 2.57317642e-05 6.28422952e-05 2.11290499e-05
2.53498513e-05 9.42634428e-06 1.97215226e-26 1.86621483e-25]' has dtype incompatible
with int64, please explicitly cast to a compatible dtype first. netlist.loc[R_map, ("power_loss")] = P_loss
I am currently using pybamm version 23.4 and pandas==2.2.0. It looks like the code is attempting to assign a non-integer array to a pandas DataFrame column that expects integer values, which might not be an issue now but could cause errors with future pandas releases.
This should be fixed already in the released version. I guess you may have cloned the source and were using the main branch as this was out of date. I have just updated it and made a new release from develop
I encountered a
FutureWarning
while working withliionpack
that seems related to a potential future error due to setting an item with an incompatible dtype innetlist_utils.py
. The warning suggests that a future version of pandas will raise an error for this operation, specifically when setting values of a dtype incompatible withint64
.Here's the warning message I received:
I am currently using
pybamm
version 23.4 andpandas==2.2.0
. It looks like the code is attempting to assign a non-integer array to a pandas DataFrame column that expects integer values, which might not be an issue now but could cause errors with futurepandas
releases.