Categories
Python Answers

How to use Python Pandas read_csv with URL?

Spread the love

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

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

How to use Python Pandas read_csv with URL?

To use Python Pandas read_csv with URL, we can call read_csv directly with a url.

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 with the csv to read it into a data frame.

Conclusion

To use Python Pandas read_csv with URL, we can call read_csv directly with a url.

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 *