Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

Loading csv file in python error

$
0
0

@tarun08 wrote:

I have used the above article to create the classifier.
In the last, I have changed the file name as shown below.

sample = pd.read_csv(‘Sample_Submission_lxuyBuB.csv’)
sample[‘sample_submission’] = test_file[‘test.csv’]
sample[‘label’] = prediction
sample.to_csv(‘sample.csv’, header=True, index=False)

and I am getting this error

KeyError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2656 try:
-> 2657 return self._engine.get_loc(key)
2658 except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘test.csv’

I am not able to identify this thing.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles