728x90
In [1]:
import pandas as pd
In [2]:
# examples
s1 = pd.Series(data = [100, 300, 500, 1000, 1500]); s1
Out[2]:
0 100
1 300
2 500
3 1000
4 1500
dtype: int64
In [3]:
# sum
s1.sum()
Out[3]:
3400
In [4]:
# multiplication
s1.product()
Out[4]:
22500000000000
In [5]:
# average
s1.mean()
Out[5]:
680.0
In [6]:
# show the first cople of elements
#s1.head(2)
Out[6]:
0 100
1 300
dtype: int64
In [9]:
# create a new Series
new_s1 = s1.head(3); new_s1
Out[9]:
0 100
1 300
2 500
dtype: int64
In [11]:
# show the last cople of elements
s1.tail(2)
Out[11]:
3 1000
4 1500
dtype: int64
In [12]:
# How many bytes
s1.memory_usage()
Out[12]:
168
728x90
'Data Analytics with python > [Data Analysis]' 카테고리의 다른 글
[pandas][Series] S1_09_Math Operations (0) | 2023.01.17 |
---|---|
[Pandas][Series] S1_06_Reading data (CSV) (0) | 2023.01.17 |
[Pandas][Series] S1_04_Attributes: 기본 속성 (0) | 2023.01.17 |
[Pandas][Series]S1_03_A Dictionary: 사전 정의 (0) | 2023.01.17 |
[Pandas][Series] S1_02_custom_index: 사용자 지정 인덱스 (0) | 2023.01.17 |
댓글