Click here to Skip to main content
15,348,280 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I'm currently working on a problem for my coding fundamentals class. I'm learning how to visualize data in python from a pandas data frame. In this problem, I'm told to import data into a dataframe and then plot a line plot based on that dataframe. However, my line plot looks very different than the example image shown. the problem states "Create a line plot from the vehicles DataFrame that shows the change in the average city miles per gallon by year." If anyone can tell me what I'm doing wrong, it would be much appreciated

Here's my code to imput the dataframe:

import pandas as pd
vehicles = pd.read_csv(r"https://codingfundamentals.s3.amazonaws.com/vehicles.csv")

and here's my code for the line plot:

vehicles.plot(x='year', y ='citympg', kind='line')

What I have tried:

I've tried to do the code listed above, but it returns a plot that is different than the example image
Posted
Comments
Maciej Los 15-Apr-22 15:26pm
   
Waht image? I do not see it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900