Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python pandas, matplotlib -- how to use column as y index, and label axes? I have the following data set data3.csv: Hours_Studied,Grade 15,98 6,75 14,97

Python pandas, matplotlib -- how to use column as y index, and label axes?

I have the following data set data3.csv:

Hours_Studied,Grade 15,98 6,75 14,97 18,99 2,61 4,67 8,82 10,88

And the following program to plot the data:

from PIL import Image import sys import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import pandas as pd

#store the dataframe in a variable pl = pd.read_csv('data3.csv') #use the plot method on the data to draw a plot pl.plot() #save the plot to a file plt.savefig("plot.png")

#open the image file with Image.open("plot.png") as img: img.load() #print the image print(img.show())

My output looks like this:

image text in transcribed

How can I modify my program so that instead of the index values 0-7 being used as the x axis values, one column (Hours Studied) is used as the x axis and the other column (Grade) is used as the y axis? Also, is there a way to label the axes?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Carlos Coronel, Steven Morris

14th Edition

978-0357673034

More Books

Students also viewed these Databases questions

Question

What are Electrophoresis?

Answered: 1 week ago

Question

=+How might these stem from country and regional cultures?

Answered: 1 week ago