01 Data Handling Using Pandas I
01 Data Handling Using Pandas I
Prepared by
Sanjay Kumar Parmar
BCA, MSc(IT)
PGT - Computer Science,
Sardar Patel Vidyalaya, Sewagram
Downloaded from : www.tutorialaicsip.com
import pandas as pd
import numpy as np
Series
An important data structure of pandas
Represents one-dimensional array, containing an
array of data of any NumPy data type
Series has two components:
i. An array ii. An associated array of indexes or data
Creating Series Objects
It can be created by using pandas Series()
S must
Creating an empty Series object capital
All Elements
Modifying Elements
Series
objects are
value-
mutable but
size-
immutable
objects.
Extracting Slices from Series
head() Function
head() Function: fetch first n rows from series
tail() Function
tail() Function: fetch last n rows from series
If no value provided for n,
then head() and tail() will
return first 5 and last 5 rows
respectively of pandas
object.
Vector & Arithmetic Operations on Series
reindex() and drop() Methods
Reindex() : Create a similar object but with a different
order of same indexes.