Fix use of .loc[] in sensitive places for pandas
Created by: fsoubelet
In some places, the use of .loc[]
on pandas
dataframes with list objects is a problem as some of the elements might not be found in the Index, which raises since 1.0.0
. Example below:
KeyError: "Passing list-likes to .loc or [] with any missing labels is no longer supported.
The following labels were missing: Index(['BPTUH.A4L5.B1', 'BPTDH.A4L5.B1', 'BPTUV.A4L5.B1', 'BPTDV.A4L5.B1',\n 'BPMWK.1L5',\n ...\n 'BPTUV.A4L2.B1', 'BPTDV.A4L2.B1', 'BPMSW.1L2.B1_DOROS',\n 'BPMSW.1R2.B1_DOROS', 'LHCB1IP3_P_'],\n dtype='object', length=37).
See https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike"
Clickable link from the error message.
I have encountered the issue in rdt.py and crdt.py for instance.