Pandas: Create a scatter plot of the trading volume/stock prices
16. Scatter Plot: Trading Volume vs. Stock Prices
Write a Pandas program to create a scatter plot of the trading volume/stock prices of Alphabet Inc. stock between two specific dates.
Use the alphabet_stock_data.csv file to extract data.
alphabet_stock_data:
alphabet_stock_data Table
Date | Open | High | Low | Close | Adj Close | Volume |
---|---|---|---|---|---|---|
2020-04-01 | 1122 | 1129.689941 | 1097.449951 | 1105.619995 | 1105.619995 | 2343100 |
2020-04-02 | 1098.26001 | 1126.859985 | 1096.400024 | 1120.839966 | 1120.839966 | 1964900 |
2020-04-03 | 1119.015015 | 1123.540039 | 1079.810059 | 1097.880005 | 1097.880005 | 2313400 |
2020-04-06 | 1138 | 1194.660034 | 1130.939941 | 1186.920044 | 1186.920044 | 2664700 |
... | ... | ... | ... | ... | ... | ... |
... | ... | ... | ... | ... | ... | ... |
2020-09-29 | 1470.390015 | 1476.662964 | 1458.805054 | 1469.329956 | 1469.329956 | 978200 |
2020-09-30 | 1466.800049 | 1489.75 | 1459.880005 | 1469.599976 | 1469.599976 | 1700600 |
Sample Solution:
Python Code :
Sample Output:
Click for download alphabet_stock_data.csv
For more Practice: Solve these Related Problems:
- Write a Pandas program to create a scatter plot comparing trading volume and closing stock prices over a selected time period.
- Write a Pandas program to generate a scatter plot with trading volume on one axis and open prices on the other, adding a trend line.
- Write a Pandas program to plot a scatter chart that visualizes the relationship between trading volume and stock prices using custom markers.
- Write a Pandas program to create a scatter plot that correlates trading volume with high prices and color-code points based on date ranges.
Go to:
Previous: Write a Pandas program to create a plot of adjusted closing prices, 30 days simple moving average and exponential moving average of Alphabet Inc. between two specific dates.
Next: Write a Pandas program to create a plot to visualize daily percentage returns of Alphabet Inc. stock price between two specific dates.
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.