Page 459 - AI Ver 3.0 class 10_Flipbook
P. 459
• Missing data, represented as NaN (Not a Number), is easily and efficiently handled, regardless of data type.
• Columns in DataFrames can be easily inserted, modified, or deleted.
• Objects can be explicitly aligned to a set of labels or automatically handled by data structures for smooth
processing and analysis.
• Data organisation and labelling are effectively managed through intelligent slicing, alignment, and indexing
methods.
• It provides robust support for data cleaning needed for processing.
• Pandas offers strong support for reshaping, merging, and joining datasets with great efficiency.
Matplotlib
Matplotlib was created by John D. Hunter in 2003. It is a free and open-source data visualisation library
used for plotting graphs and visualisation in Python. Built on NumPy arrays, it can be downloaded from
https://matplotlib.org. With just a few lines of code, we can generate a wide range of plots, including line plots,
histograms, bar charts, scatterplots, etc.
Matplotlib comes with various plotting modules, but the most commonly used module is pyplot, which provides
an easy interface for creating 2D plots and visualisations.
Visuals have a significant impact on human cognition. The plots created using Matplotlib help us to understand
trends, patterns, and correlations within data, presenting quantitative information in a visual form. After creating
plots, you can customise their style, appearance, and make them more descriptive and communicative.
Some types of graphs that we can make with this package are listed below:
Histogram Pie Plot Box Plot Scatter Plot Line Graph
Installing Matplotlib
• To install it using pip:
python -m pip install -U pip
python -m pip install -U matplotlib
Or
pip install matplotlib
For plotting using Matplotlib, we need to import its Pyplot module as follows:
import matplotlib.pyplot as plt
The pyplot module of matplotlib has built in methods which help in designing a graph with all features. Few of
the functions are explained below:
• The plot(x,y,marker) function is used to create a box-like figure where the actual graph is plotted. To plot x axis
versus y axis, we write plt.plot(x,y). By default, it plots a line graph.
Advance Python (Practical) 457

