Series

Learning Objectives

  • What is Series?

  • Create a Series

Pandas Objects

Before we dive into series, let’s do a quick recap of pandas ‘objects’. At the core of the pandas library there are two fundamental data structures/objects:

  • Series

  • Data Frames

What is Series?

  • A one dimensional labeled array

  • Can hold data of any type

  • Are like a column in a table

What can a Series have?

  • A Series can have all the elements as numbers in it

  • A Series can have all the elements as strings in it

  • A Series can have its elements as both numbers and strings.

  • But the data type of the Series is always ‘object’ in this case

  • Series is like a list in Python which can take any type of value like integer, strings, float (or decimal value), etc

  • All the items in series are labeled with indexes

  • By default indexing starts from 0 in Series.

Human vs Python Index

  • Indexes that we (Human) understand

  • Indexes that Python Understand

Well, it all starts with ‘0’. That’s the only difference.

Create a Series

  • Remember to import library before using it!

    import pandas as pd

  • You can create your own Series using list

  • You can create your own Series using a dictionary

Last updated

Was this helpful?