Member-only story

Pandas Tutorial: Pandas Series With Key/Value Pairs

Jesse L
3 min readOct 13, 2021

--

Hi everyone, welcome back. Pandas is a library for the Python programming language and is commonly used for data science purposes. Pandas can refer to both “Panel Data” and “Python Data Analysis”. Pandas is used specifically for working with data sets and provides various functions and support regarding data. In order to use Pandas on your machine, you will need Python and Pandas installed and ready to go. Getting started with Pandas can be found here.

Pandas makes many data-related tasks easy for developers and data scientists. One of the data structures that Pandas uses are series and we will look into how we can add and manipulate key/value pairs(similar to a Python dictionary) within a series.

Creating a Pandas Series

Let’s see an example of how we can create a Pandas series:

import pandas as pd
myData = ["one", "two", "three"]
mySeries = pd.Series(myData)
print(mySeries)
Output:
0 one
1 two
2 three
dtype: object

As you can see in our output, we have successfully created a series and displayed its contents. Our output contains our data, but also provides index numbers that corresponds to each piece of data within our series.

Creating a Series with Key/Value…

--

--

Jesse L
Jesse L

Written by Jesse L

Hi, I'm a passionate technology enthusiast and lifelong learner. Beyond my technical pursuits, I'm also passionate about sharing my enthusiasm with others.

No responses yet