Python Pandas Series: Introduction

According to Pandas Data Structure Series is used to represent a single column in memory that is either independent or belongs to Pandas DataFrame. Series can also have its own independent existence without being part of DataFrame.
Series is a sequence of values with associated labels. These axis labels are collectively called indexes.

It is a one-dimensional array that is capable of holding data of any type that can be integer, string, float, python objects etc.  A Series is like a column in an excel sheet.

Creating a Pandas Series

A Pandas Series is created over a python list or NumPy array. It has to be remembered that the series will contain data of the same type. Pandas series can also be created by loading the datasets from existing storage, storage can be SQL Database, CSV file, an Excel file.


import pandas as pd

data = ['P','Y','T','H','O','N']
series_1 = pd.Series(data)


0    P
1    Y
2    T
3    H
4    O
5    N
dtype: object
Tue, 11/02/2021 - 13:52

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.