Page 231 - AI Ver 1.0 Class 10
P. 231
To print the first ten rows of the file:
print (s.head(10))
To sort the records in the file:
s1 = s.sort_values(by='Name',ascending = False)
print(s1.head(5))
Python with Pandas is used in a wide range of fields including academic and commercial domains including
finance, economics, statistics, analytics, etc.
Pandas can perform some of the important functions like:
• It provides a fast and efficient way to manage and explore data using Series, DataFrames and Panels which
makes it really fast and suitable for data science.
• Missing Data represented as NaN and of any data type is very easily and efficiently handled.
• Columns can be easily inserted, modified and deleted from DataFrame and Panel.
• Objects can be explicitly aligned by the users to a set of labels, or automatically handled by data structures for
smooth processing and data analysis.
• Organization and labeling of data are perfectly taken care of by the intelligent methods of slicing, alignment
and indexing.
• It provides support for cleaning of data needed for processing.
• It provides strong support for reshaping, merging and joining various datasets with extreme efficiency.
Matplotlib
Matplotlib was created by John D. Hunter in 2003. It is a free and open-source data visualization library in Python
built on NumPy arrays and can be downloaded from https://www.matplotlib.org .
It comes with a wide variety of plots but the most used module of Matplotib is Pyplot which is used for creating
2D plots of arrays.
Visuals have more impact on human brains. So, these plots created using Matplotlib help us understand the trends,
patterns, correlations of the data. They give us the quantitative information of data in a visual form. After the plots
are created, you can change the style, look and make them more descriptive and communicable.
Installing Matplotlib
Following are the ways to install
• To install it using pip:
python -m pip install -U pip
python -m pip install -U matplotlib
• To install using Anaconda:
conda install matplotlib
Or
conda install -c conda-forge matplotlib
Data Science 229

