본문 바로가기
프로그래밍/파이썬(Python)

파이썬(Python) Pandas Dataframe

by comflex 2022. 8. 3.
728x90
반응형

Dataframe

Dataframe은 파이썬 Pandas의 자료 구조 중 하나이다.

다수의 Series를 하나의 Dataframe에서 관리할 수 있다.

  • 코드
d1={'a':1,
      'b':2,
      'c':3,
      'd':4,
      'e':5,
      'f':6}

d2={'a':7,
      'b':8,
      'c':9,
      'd':10,
      'e':11,
      'f':12}

s1 = pd.Series(d1)
s2 = pd.Series(d2)



df = pd.DataFrame({'d1': d1, 'd2':d2})

print(df)
  • 출력
   d1  d2
a   1   7
b   2   8
c   3   9
d   4  10
e   5  11
f   6  12

인덱스 확인은 df.index, 컬럼 확인은 df.columns 명령을 사용하면 된다.

728x90
반응형