KnowledgeBoat Logo
|

Robotics & Artificial Intelligence

Explore the Pandas library to read the data that is available in .csv or .xlsx files. Plot the data with the help of Matplotlib.

Python Modules

1 Like

Answer

The Pandas library is used to read data from .csv files, and the Matplotlib library is used to plot the data.

# data.csv

X,Y
1,2
2,4
3,6
4,8
5,10

Program

import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv("data.csv")
plt.plot(data['X'], data['Y'])
plt.xlabel('X')
plt.ylabel('Y')
plt.title('Plot using Pandas and Matplotlib')
plt.show()

Output

Explore the Pandas library to read the data that is available in .csv or .xlsx files. Plot the data with the help of Matplotlib. Modules and Packages in Python, KIPS ICSE Robotics & Artificial Intelligence Solutions Class 9.

Answered By

3 Likes


Related Questions