Data Handling using Pandas –PART B



 Creating a series from Scalar value


To create a series from scalar value, an index must be provided. The scalar value will be repeated as per the length of index.




Creating a series from a Dictionary




Mathematical Operations in Series



Head and Tail Functions in Series


head (): It is used to access the first 5 rows of a series. 

Note :To access first 3 rows we can call series_name.head(3)



tail(): It is used to access the last 5 rows of a series. 

Note :To access last 4 rows we can call series_name.tail (4)


Selection in Series


Series provides index label loc and ilocand [] to access rows and columns.

1. loc index label :-

Syntax:-series_name.loc[StartRange: StopRange]

 Example-

2. Selection Using iloc index label :-

Syntax:-series_name.iloc[StartRange : StopRange] 

Example-




3. Selection Using [] :

Syntax:-series_name[StartRange> : StopRange] or series_name[ index]

Example-




Slicing in Series

Slicing is a way to retrieve subsets of data from a pandas object. A slice object 
syntax is –
SERIES_NAME [start:end: step]

The segments start representing the first item, end representing the last item, and step representing the increment between each item that you would like.
Example :-




Post a Comment

0 Comments