> Status Failed

When i try to submit a file, i got following error
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 "/tmp/codalab/tmpW4IS9F/run/program/evaluate.py", line 86, in
predicted.append(submission_dict[key])
KeyError: '8389'

Posted by: talhaanwar @ Feb. 20, 2020, 7:15 a.m.

Same problem here, is there any Fix for this problem ?

Posted by: ALAMIHamza @ Feb. 23, 2020, 9:37 a.m.

try this

import csv
import pandas as pd
test=pd.read_csv( 'testset.tsv',sep='\t',quoting=csv.QUOTE_NONE,encoding='utf-8')

Posted by: talhaanwar @ Feb. 23, 2020, 9:56 a.m.

Thank you a lot, you are a life saver,

Posted by: ALAMIHamza @ Feb. 23, 2020, 11:27 a.m.

Thank you Talha for spreading this info. Yes, to read a csv file correctly using Pandas frames in Python, we should consider these parameters when we open the file:
quoting=csv.QUOTE_NONE,encoding='utf-8'
Alternatively, you can just read the csv file line by line.
Good luck!

Posted by: hmubarak @ Feb. 24, 2020, 5:46 p.m.

I don't understand, I submit a csv with id label for each prediction.
I get the same error.
I don't understand what/why I need to read with pandas.

Posted by: machouz @ Feb. 29, 2020, 4:52 p.m.

Dear Participants,
As explained before, the expected format is: id,label (id is the same id found in the test file which starts from 8000 until 10000)

put labels in a .csv file (it should have 2,000 lines), zip the file (.zip) and submit to CodaLab.
If you still encounter problems, you can send the submitted file to hmubarak@hbku.edu.qa

Good luck,
Competition Organizer

Posted by: hmubarak @ March 1, 2020, 6:07 a.m.

Pandas KeyError occurs when we try to access some column/row label in our DataFrame that doesn’t exist. Usually, this error occurs when you misspell a column/row name or include an unwanted space before or after the column/row name.. 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: macronbell @ Dec. 19, 2022, 6:32 a.m.
Post in this thread