728x90
In [1]:
import pandas as pd
In [6]:
prices = pd.read_csv('/content/sample_data/prices.csv', squeeze=True); prices
Out[6]:
0 2.55
1 3.39
2 2.75
3 3.39
4 3.39
...
541905 2.10
541906 4.15
541907 4.15
541908 4.95
541909 18.00
Name: Price, Length: 541910, dtype: float64
In [3]:
# the first element in a Pandas Series
# ★ index starts from zero!
prices[0]
Out[3]:
2.55
In [12]:
# the fifth element in a Pandas Series
# specific index = Ordinal Number(순서) - 1
prices[4]
Out[12]:
3.39
In [7]:
# the last element in a Pandas Serie
# the last indexing = Length - 1 because of starting from zero
prices[541909]
Out[7]:
18.0
In [11]:
prices[len(prices)-1]
Out[11]:
18.0
728x90
'Data Analytics with python > [Data Analysis]' 카테고리의 다른 글
[Pandas][DaraFrame]S2_01_DataFrame (0) | 2023.01.17 |
---|---|
[Pandas][Series]S1_12_Slicing (0) | 2023.01.17 |
[pandas][Series]S1_10_Checking element (0) | 2023.01.17 |
[pandas][Series] S1_09_Math Operations (0) | 2023.01.17 |
[Pandas][Series] S1_06_Reading data (CSV) (0) | 2023.01.17 |
댓글