Categories
Python Answers

How to use Python Pandas read_csv with a URL?

Spread the love

Sometimes, we want to use Python Pandas read_csv with a URL.

In this article, we’ll look at how to use Python Pandas read_csv with a URL.

How to use Python Pandas read_csv with a URL?

To use Python Pandas read_csv with a URL, we just call read_csv with the URL of the CSV.

For instance, we write

import pandas as pd

url="https://raw.githubusercontent.com/cs109/2014_data/master/countries.csv"
c=pd.read_csv(url)

to call read_csv with the url of the CSV and assign the returned data frame to c.

Conclusion

To use Python Pandas read_csv with a URL, we just call read_csv with the URL of the CSV.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *