Passwd

  • 홈
  • 태그
  • 글쓰기
  • 관리

2025/04/30 1

[Pandas] itertuples - 컬럼 접근 방법(?)

개요Pandas에서 DataFrame.itertuples을 사용하면 DataFrame의 각 행을 namedtuples 형식으로 반환한다.이번 글에서는 이 namedtuples을 사용해 컬럼에 접근하는 예시를 하나 적어두려고 한다. + 다른 사람이 작성한 코드에서 봤는데, 낯선 방법이라 적어둔다. 방법itertuples 함수 결과로 변환된 row는 Pandas 객체이다. 이 부분은 namedtuples의 type을 확인해보면 알 수 있다.import pandas as pddata = {'col1':[1,2],'col2':[3,4]}idx = ['row1','row2']df = pd.DataFrame(data = data, index=idx)for row in df.itertuples(): print..

Python/NumPy | Pandas 2025.04.30
1
더보기
프로필사진

아무튼 개발자. 모르는 걸 적습니다.

  • 분류 전체보기 N
    • 자료구조
    • Algorithm
      • 모두의 알고리즘 with Python
      • 문제 풀이
    • Apache Airflow
      • 삽질
    • Apache Nifi
    • Apache Superset
    • AWS
    • Azure
    • Database
    • Docker
    • Git | GitLab
    • Grafana
    • Hadoop EcoSystem
    • R
    • Java
    • Jenkins
    • Kubernetes
      • 삽질
      • Udemy - CKAD with Tests
      • KoudKloud - CKAD with Tests
    • Python N
      • NumPy | Pandas
    • Linux
      • Shell Script
    • Snowflake
    • Trino
    • 기타
      • Python → Webhook
      • Redmine on AWS
    • Windows

최근글

인기글

공지사항

Archives

Tag

k8s, 프로그래머스, BOJ, gitlab, Linux, superset, 티스토리챌린지, awscli, 오블완, Trino, Docker, jenkins, SH, AWS, pandas, python, Azure, Git, mysql, airflow,

Calendar

«   2025/04   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
250x250

Copyright © Kakao Corp. All rights reserved.

  • 알고리즘

티스토리툴바