Page 294 - Ai_C10_Flipbook
P. 294
Pandas was created by Wes McKinney in 2008. The name "Pandas" is derived from Panel Data (a term in statistics
for multidimensional data) and Python, as it was designed for data analysis in Python.
Pandas is built on top of NumPy, so while you don't need to be an expert in NumPy to use Pandas, familiarity
with NumPy can be helpful when performing operations on data.
Pandas is highly flexible, allowing you to work with:
• Tabular data with heterogeneously-typed columns, like in an SQL table or Excel spreadsheet.
• Ordered and unordered time series data, which may not necessarily be of fixed frequency.
• Arbitrary matrix data, either homogeneous or heterogeneous, with row and column labels.
• A wide range of observational or statistical datasets.
Installing Pandas
To install Pandas from command line, we need to type in:
pip install pandas
All libraries including NumPy and Pandas can be installed only when Python is already installed on that system.
Two commonly used data structures in Pandas are Series and DataFrames.
Series
Series is a one-dimensional array that can store data of any type like integer, string, float, python objects, etc.
We can also say that the Pandas series is just like a column of a spreadsheet.
The values can be referred to by using data axis labels also called index. Indexes are of two types: positional
index and labelled index. Positional indexes are integers starting with default 0 whereas labelled indexes are user
defined labels that can be of any datatype and can be used as an index.
Pandas Series can be created by loading the datasets from existing storage like SQL Database, CSV file, and Excel
file. Pandas Series can also be created from the lists, dictionary, and from any other scalar value.
Creating Series
Different ways of creating Series are:
• Creating an empty series
[1]: import pandas as pd
Emp=pd.Series()
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.
292 Artificial Intelligence Play (Ver 1.0)-X

