Graph in python(1)
Csv file:
A Comma Separated Values (CSV) file is a plain text file that contains a list of data. These files are often used for exchanging data between different applications. For example, databases and contact managers often support CSV files.
What is Graph:
a graph can be defined as a pictorial representation or a diagram that represents data or values in an organized manner. The points on the graph often represent the relationship between two or more things.We then represent the data using a bar graph.
What is Matplotlib.pyplot:
matplotlib. pyplot is a collection of command style functions that make matplotlib work like MATLAB. Each pyplot function makes some change to a figure: e.g., creates a figure, creates a plotting area in a figure, plots some lines in a plotting area, decorates the plot with labels, etc
1st program:
How to make a Graph in python:
1-Make any file suppose i make a file named as (data) and save as csv file.
2-import pandas as pd.
3-import matblotlib.pyplot as plt
4-take any variable i take(df) which is equal to pd.read_csv("file")
5-df.plot()
6-plt.show()
Code:
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("data.csv")
df.plot()
plt.show()
if it can not work write plt.show() again
plt.show()
Output:
2st program:
1-Make any file suppose I make a file named as ("Corona.csv") and save as csv file.
2-import pandas as pd.
3-import matblotlib.pyplot as plt
4-take any variable I take(a) which is equal to pd.read_csv("file")
5-df.plot()
6-plt.show()