Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Practical 2 : Plotting a trend graph in Python A trend Graph is a graph that is used to show the trends data over

Python Practical 2: Plotting a trend graph in Python
A trend Graph is a graph that is used to show the trends data over a period of time.
It describes a functional representation of two variables (x , y).
In which the x is the time-dependent variable whereas y is the collected data.
The graph can be in shown any form that can be via line chart, Histograms, scatter plot, bar chart, and pie-chart.
In python, we can plot these trend graphs by using matplotlib.pyplot library.
It is used for plotting a figure for the given data.
Using the below Examples, generate the appropriate Output & Graph:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#create a dataframe
Sports ={
"medals": [100,92,102,56,78,56,78,96]
"Time_Period": [2010,2011,2012,2013,2014,2015,2016,2017]
}
df = pd.DataFrame(Sports)
print(df)
#to plot the graph
df.plot(x="Time_Period", y="medals", kind="line")
Practice 2: Using the above data plot the scatter and bar graph.

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago