Forums

Problems trying to turn uploaded csv file into dataframe

Trying to concatenate a series of csv files to visualise the popularity of baby

df = pd.read_csv('https://www.pythonanywhere.com/user/elksie5000/files/home/elksie5000/girls_long_count.csv')

But when I did I got this error

Error: ParserError: Error tokenizing data. C error: Expected 1 fields in line 11, saw 2

You can see the data in a question on Stackoverflow here: https://stackoverflow.com/questions/77071949/parsererror-error-tokenizing-data-c-error-expected-1-fields-in-line-11-saw-2

Then. I tried this: df = pd.read_csv('https://www.pythonanywhere.com/user/elksie5000/files/home/elksie5000/girls_long_rank.csv, on_bad_lines='skip')

That returned: <!DOCTYPE html>

0   <html lang="en" style="height: 100%">
1   <head>
2   <!-- Google tag (gtag.js) -->
3   <script async src="https://www.goo...
4   <script>
... ...
151 </div>

The raw data looks like this.

,Name,Gender,Year,Measure,Value,first_letter 55512,A'Idah,girl,2021,Count,0,A 55513,A'Isha,girl,2021,Count,3,A 55514,A'Ishah,girl,2021,Count,4,A 55515,A'Niyah,girl,2021,Count,0,A 55516,Aa'Idah,girl,2021,Count,4,A 55517,Aa'Isha,girl,2021,Count,0,A 55518,Aa'Ishah,girl,2021,Count,0,A 55519,Aabha,girl,2021,Count,3,A 55520,Aabida,girl,2021,Count,3,A 55521,Aabidah,girl,2021,Count,0,A 55522,Aabish,girl,2021,Count,0,A 55523,Aadhira,girl,2021,Count,13,A 55524,Aadhiraa,girl,2021,Count,3,A 55525,Aadhya,girl,2021,Count,35,A 55526,Aadila,girl,2021,Count,0,A

What's wrong here?

You will not be able to access a pythonanywhere site from a free account. If you have the file on your filesystem, why not just read it from there?