Pandas Concepts: Reference and Examples

Last updated:
Table of Contents

WIP Alert This is a work in progress. Current information is correct but more content may be added in the future.

Index

A Index is just an array.

import pandas as pd

i = pd.Index([0,1,2,3])
# Int64Index([0, 1, 2, 3], dtype='int64')

An Index may contain non-numeric elements

import pandas as pd

string_i = pd.Index(['a','b','c','d'])
string_i
#Index(['a', 'b', 'c', 'd'], dtype='object')

Series

A Series is an array plus an Index.

import pandas as pd

i = pd.Index([0,1,2,3])
# Int64Index([0, 1, 2, 3], dtype='int64')

s = pd.Series([10,20,30,40],index=i)
# 0    10
# 1    20
# 2    30
# 3    40
# dtype: int64

Access elements in a Series using the Index

TODO

An Index is created by default when you create a Series

TODO

Dataframe

TODO

Index vs Series

TODO

Series vs Dataframe

TODO

Dataframes and Indexes

TODO

Dialogue & Discussion