Data Analytics with python/[Data Analysis]
[Pandas][Series] S1_04_Attributes: 기본 속성
보끔밥0130
2023. 1. 17. 15:04
728x90
In [1]:
import pandas as pd
Attributes / Properties : do not use
parantehsees(소괄호) "()"
① use parantheses in Methods:
"()"은 인자를 포함하고 시리즈 객체를 바꾸는 경우 사용한다.
ex) data.heand()
② use square brackets in Indexers :
"[]"은 시리즈나 데이터 프레임 안에 구체적인 요소에 접근할 경우 사용한다.
ex) data.loc[], data.iloc[]
In [2]:
# example1
list1 = ['NVDA','MSFT','META','AMZN','GOOGL']
s1 = pd.Series(data = list1); s1
Out[2]:
0 NVDA
1 MSFT
2 META
3 AMZN
4 GOOGL
dtype: object
In [3]:
# return Series as ndarray depending on its dtype
s1.values
Out[3]:
array(['NVDA', 'MSFT', 'META', 'AMZN', 'GOOGL'], dtype=object)
In [4]:
# return the axis labels of the Series
s1.index
Out[4]:
RangeIndex(start=0, stop=5, step=1)
In [5]:
# datatype of the Series
# 'o' is 'object'
s1.dtype
Out[5]:
dtype('O')
In [6]:
# all elements are unique - boolen
s1.is_unique
Out[6]:
True
In [7]:
# the shape of the Series
# A Series is one dimensional
s1.shape
Out[7]:
(5,)
In [8]:
# the size of the Series
s1.size
Out[8]:
5
728x90