From the course: Build Three Real-World Python Applications

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

How to put stock data into a DataFrame

How to put stock data into a DataFrame - Python Tutorial

From the course: Build Three Real-World Python Applications

How to put stock data into a DataFrame

- It is nice to have our data pulled into Python with tuples and BeautifulSoup but many programmers like being able to store their data in a data frame to use the full potential of the pandas package. I will show how to do this for both methods. Let's begin by showing how to do this for the request method. We are going to begin by typing an our URL variable. We will Copy + Paste in that time series weekly URL we had earlier with the + string API key at the end. And this time we are going to add one extra thing to the end. So we are going to do + and then in quotation marks, we will have the & sign and then datatype=csv. Make sure this is typed exactly with no extra spaces. After this, we can gather our R variable, and equal it to request.get on our URL variable, and this time make sure you add .content on the end to help us gather the data. Next, we have our data variable, and we are going to equal it to pd.read_csv.…

Contents