Python - Lesson 4
Python - Lesson 4
02 04
Function Pandas
MODULE 4.
PANDAS
Module 4: Pandas
Introduction to Pandas
Module 4: Pandas
Series – Creation
Creation:
• S = pd.Series(data,
index=index_list)
• Data can be many different things:
+ Python dict
+ An np.array
+ List
Module 4: Pandas
Series - Creation
Import pandas as pd
s1 = pd.Series( [1, 2, 3, 4] )
s2 = pd.Series( [1, 2, 3, 4], index=[‘A’, ’B’, ’C’, ’D’])
s1 s2
0 1 A 1
1 2 B 2
2 3 C 3
3 4 D 4
Module 4: Pandas
Series is ndarray-like
Module 4: Pandas
Series is dict-like
A Series is like a fixed-size dict in that you can get and set values by index label
Module 4: Pandas
DataFrame - Creation
• DataFrame is a 2D labeled data structure with columns of potentially
different types.
• It accepts many different kinds of input:
+ Dict of 1D ndarrays, lists, dicts, or Series
+ 2-D numpy.ndarray
+ Structured or record ndarray
+ A Series
+ Another DataFrame
Module 4: Pandas
DataFrame - Creation
one two
a 1 1
b 2 2
c 3 3
d NaN 4
Module 4: Pandas
DataFrame - extraction
The elementary extraction methods
Module 4: Pandas
DataFrame - extraction
Module 4: Pandas
DataFrame - Operators
Module 4: Pandas
DataFrame - Operators
Module 4: Pandas
DataFrame - Statistics
The statistical functions such as: min(), max(), mean(), median(), sum(), cumsum(), var(), std()…
also work on DataFrame
DataFrame – Merge
Module 4: Pandas
DataFrame - Append
Module 4: Pandas
DataFrame - Grouping
THANKS
CREDITS: This presentation template was created by
Slidesgo, including icons by Flaticon, and Name: Nguyễn Lê Chí Bảo
infographics & images by Freepik and illustrations Email: [email protected]
by Storyset Phone: 091 544 2420
Linkedin: nguyenlechibao