Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: invalid literal for int() with base 10: 'label' #16

Open
Mustyy opened this issue Sep 26, 2018 · 7 comments
Open

ValueError: invalid literal for int() with base 10: 'label' #16

Mustyy opened this issue Sep 26, 2018 · 7 comments

Comments

@Mustyy
Copy link

Mustyy commented Sep 26, 2018

Preprocessing still doesn't happen since there is an error in this line:
positive = int(line[:line.find(',')])

Here is the warning I get: ValueError: invalid literal for int() with base 10: 'label'

I looked up how to fix this and it looks like the string cannot be converted to int, so I tried int(float(...)) but didn't work

Any ideas?

@abdulfatir
Copy link
Owner

Why would you try int(float(...))?
Anyway, looks like your CSV headers are the cause of the problem. Remove the column names from the CSV or modify the code to skip that line.

@Mustyy
Copy link
Author

Mustyy commented Sep 26, 2018 via email

@Mustyy
Copy link
Author

Mustyy commented Sep 26, 2018 via email

@kanzn
Copy link

kanzn commented Nov 21, 2018

Why would you try int(float(...))?
Anyway, looks like your CSV headers are the cause of the problem. Remove the column names from the CSV or modify the code to skip that line.

Hi @abdulfatir and thank you for you sharing,

I was able make the Preprocessing with train.csv with his 3 columns, but I got the same error although I remove the column names from test.csv , I think script process the data in the same way, how script can make the difference between train and test files ?

@ArnabMallik
Copy link

In preprocess.py, for lines 71 and 107, change test_file=True

@KunikaValecha
Copy link

Preprocessing still doesn't happen since there is an error in this line:
positive = int(line[:line.find(',')])

Here is the warning I get: ValueError: invalid literal for int() with base 10: 'label'

I looked up how to fix this and it looks like the string cannot be converted to int, so I tried int(float(...)) but didn't work

Any ideas?

Recheck the columns in your csv file. It might have the sentiment placed at some some another index.
e.g. - instead of tweet_id, sentiment, tweet , it could be tweet_id, tweet, sentiment or sth similar.
Either change the index of code. or change the place of column in csv itself by cutting and copying the content of it just next to tweet_id.

@shry4ns
Copy link

shry4ns commented Jul 8, 2019

I had the same error, but it was an issue with my csv headers. Anyway, thanks for the great library Abdul! I found it very helpful :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants