pandas DataFrame vs Series

김무연·2024년 4월 30일

가장 큰 차이점

기본적인 가장 큰 차이점은 컬럼의 갯수이다.

시리즈는 컬럼이 1개, 데이터프레임은 1개 이상

data = [1,2,3,4]

series = pd.Series(data)
print(series)
print(series.shape)
print(type(series))

print('------')
dataframe = pd.DataFrame(data)
print(dataframe)
print(dataframe.shape)
print(type(dataframe))

>>
0    1
1    2
2    3
3    4
dtype: int64
(4,)
<class 'pandas.core.series.Series'>
------
   0
0  1
1  2
2  3
3  4
(4, 1)
<class 'pandas.core.frame.DataFrame'>
profile
Notion에 정리된 공부한 글을 옮겨오는 중입니다... (진행중)

0개의 댓글