BMMR2: Breast Multiparametric MRI for prediction of NAC Response Forum

Go back to competition Back to thread list Post in this thread

> Error when submitting the results

Hi, I have seen the following error messages when the program is analyzing the results I submitted:

WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2895, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'MEAN_ADC_PCTCHG_T0_T2'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/tmp/codalab/tmpriIEGj/run/program/scoring_program.py", line 67, in
X = np.array(join['MEAN_ADC_PCTCHG_T0_T2'])
File "/opt/conda/lib/python3.7/site-packages/pandas/core/frame.py", line 2906, in __getitem__
indexer = self.columns.get_loc(key)
File "/opt/conda/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2897, in get_loc
raise KeyError(key) from err
KeyError: 'MEAN_ADC_PCTCHG_T0_T2'

It looks like the dataframe is missing the key 'MEAN_ADC_PCTCHG_T0_T2', which is of course not part of the tables I submitted. Any ideas how to solve this problem?

Posted by: vivixinzhi @ Sept. 15, 2021, 3:40 a.m.

Looking into this. I'll be in touch. -Organizer-

Posted by: qin-organizer @ Sept. 16, 2021, 5:49 p.m.

Hi,

The key error was my fault. I hard coded the column I needed to look up versus dynamically setting it. Try again please and thank you for your patience.

Posted by: qin-organizer @ Sept. 22, 2021, 10 p.m.

This annoying error means that Pandas can not find your column name in your dataframe. Before doing anything with the data frame, use print(df.columns) to see dataframe column exist or not.

print(df.columns)

I was getting a similar kind of error in one of my codes. Turns out, that particular index was missing from my data frame as I had dropped the empty dataframe 2 rows. If this is the case, you can do df.reset_index(inplace=True) and the error should be resolved.

http://net-informations.com/ds/pd/exists.htm

Posted by: doniervask @ May 2, 2022, 6:40 a.m.
Post in this thread