handavidbang
handavidbang

Reputation: 593

How to download dropbox csv file to pandas

I'm unfamiliar with webscraping. I found some instructions, but I'm not sure what else to do from here. Clicking on the link downloads the csv file automatically. How do I get it to my pandas jupyter notebook by webscraping?

import urllib.request
url = 'https://www.dropbox.com/s/.../movie_data.csv'
u = urllib.request.urlopen(url)
data = u.read()
u.close()

with open('movie_data.csv', "wb") as f :
   f.write(data)

Upvotes: 1

Views: 6526

Answers (1)

handavidbang
handavidbang

Reputation: 593

Figured it out. You need to append < ?dl=1 > to the end of your url like so:

df = pd.read_csv("https://www.dropbox.com/s/asdfasdfasfasdf/movie_data.csv?dl=1")

Upvotes: 19

Related Questions