Introduction To Pandas

Series

Ali Atiyab Husain

In this chapter you will learn about one of the most basic framework of pandas that is Series.

Series

A Series is a one dimensional labelled array capable of holding any data type (integer, string, float, etc.). It is one of the core data structures and also the building blocks of a DataFrame.

The basic method used to create a series is to call:-

pandas.Series( data, index, dtype, copy)

Here pd is pandas alias/nickname

Here we import pandas with the alias pd  and then we call the pd.Series() function to create a pandas series, inside this function we pass the data/datum of which we would like to create a series of . Here [1,2,3,4,5] is passed as the data inside the pd.Series()

OUTPUT

We can use the index parameter of the function to create a pandas Series where the index is according to the argument given.

Here ["first data","second data","third data"] is passed as the data for the series and index = ["1st","2nd","3rd"] is passed as the index for the series.

OUTPUT