본문 바로가기 메뉴 바로가기

여분의 해마

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

여분의 해마

검색하기 폼
  • 분류 전체보기 (90) N
    • 개발일지 (19)
    • 지식그래프(Knowledge Graph) (11)
    • 파이썬(Python)&판다스(Pandas)&Pol.. (28)
    • 오류 해결 (12)
    • 논문 (7)
    • 스크랩 (4)
    • 스터디&세미나 (5) N
    • 자료구조알고리즘 (1)
  • 방명록

combine_first (1)
[Pandas] combine_first - 두 컬럼 중 먼저 나온 값을 기준으로 새로운 컬럼 생성하기

아래 구조와 같이 col1, col2 중 먼저 나오는 데이터를 기준으로 새로운 컬럼을 만들어야하는 경우가 있다. 이때는 'combine_first'를 사용하면 만들 수 있다. import pandas as pd #둘 중 하나에 값이 있으면 합치기 df['new_col'] = df['col1'].combine_first(df['col2']) df.drop([['col1','col2]], axis=1, inplace=True) # 필요없는 컬럼은 삭제 참고 블로그 - https://wikidocs.net/153673 08-02. 다른 객체로 결측치 덮어쓰기 (combine_first) ####DataFrame.combine_first(other) ##개요 `combine_first` 메서드는 `other`의..

파이썬(Python)&판다스(Pandas)&Polars 2022. 10. 24. 17:43
이전 1 다음
이전 다음
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
  • Portfolio
TAG
  • Claude
  • deepseek
  • python
  • python'
  • SPARQL
  • vscode
  • PostgreSQL
  • pdfmathtranslate
  • rdffox
  • vertorsearch
  • Vue3
  • LLM
  • writerow
  • rdflib
  • 지식그래프
  • PEFT
  • Encoding
  • hadoop
  • vervel
  • pandas
  • cursorai
  • psycopg
  • polars
  • geospy
  • ChatGPT
  • 키워드추출
  • vectorsearch
  • MongoDB
  • Postgis
  • TextRank
more
«   2025/05   »
일 월 화 수 목 금 토
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 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바