Creating Series in PythonΒΆ

A Pandas Series is a one-dimensional labeled array that can hold any data type – strings, integers, booleans, or floats. You can create a Series from a Python list, a dictionary (where keys become the index), or a NumPy array. Understanding Series is foundational because every column in a DataFrame is a Series, and many DataFrame operations return Series objects.

This notebook demonstrates creating Series from different data types, inspecting Series attributes (.values, .index, .dtype), and performing basic aggregations (.sum(), .mean()) that operate on the entire Series at once.

import pandas as pd
ice_cream = ['vanilla','chocolate','mousse','rocky road']
pd.Series(ice_cream)
lottery = [1,2,8,4,5,22,8,9]
pd.Series(lottery)
registration = [True, False, False, True, True, True]
pd.Series(registration)
merriam = {"Work":"Office","Play":"Stadium","Study":"Class"}
pd.Series(merriam)
## Intro to Attributes
about_me = ["Yo","Yep","thats","awesomwe"]
s = pd.Series(about_me)
s
s.values
s.index
s.dtype
prices = [1.44,6.8,9.65]
s = pd.Series(prices)
s
s.sum()
s.mean()