Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

csv file not workinf properly

so I created a simple code to read a csv file in python 3.0 using pandas

import pandas as pd

df = pd.read_csv('https://www.goodreads.com/review_porter/export/153331182/goodreads_export.csv', on_bad_lines= 'skip')

print(df)
and instead of the csv file i ended with this:
<!DOCTYPE html>
0                                               <html>
1                                               <head>
2                               <title>Sign Up</title>
3    <meta content='telephone=no' name='format-dete...
4    <link href='https://www.goodreads.com/user/sig...
..                                                 ...
255                                                  }
256                                              //]]>
257                                          </script>
258                                            </html>
259  <!-- This is a random-length HTML comment: xme...

[260 rows x 1 columns]

can someone help me understand why in this particular case is not working, becouse i tryed another .csv and worked just fine. The site that i use is https://www.goodreads.com/ and the .csv file is from the export section.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Thats because that link need you to be authenticated before you can access the csv file. Since you have not passed any authentication it just read the sign up page and displaying the HTML format.

You can try this:

import requests
response = requests.get(url, auth=(username, password), verify=False)

Even if you download the csv file, it should work too.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading