드레:
코딩 뿌시기
드레:
전체 방문자
오늘
어제
  • 분류 전체보기 (268)
    • Python (74)
      • Python 기초 (42)
      • Numpy (8)
      • Pandas (22)
    • Machine Learning (31)
      • Machine Learning (1)
      • Deep Learning (27)
    • AWS (22)
      • RDS (3)
      • EC2 (9)
      • Lambda (8)
      • S3 (2)
    • MySQL (24)
    • Git (8)
    • Streamlit (12)
    • REST API (22)
    • Java (24)
    • Android (36)
    • Debugging (15)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • github
  • 깃이그노어
  • fine tuning
  • serverless
  • Callback
  • Ann
  • flask
  • AWS
  • 네이버 API
  • 서버리스
  • volley
  • Retrofit2
  • pandas
  • aws s3
  • tensorflow
  • GET
  • Java
  • CNN
  • 액션바
  • EC2
  • Lambda
  • Streamlit
  • rest api
  • Python
  • JWT
  • Transfer Learning
  • AWS Lambda
  • 딥러닝
  • 안드로이드 스튜디오
  • API

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
드레:

코딩 뿌시기

streamlit_leisure 진행중 에러(3) - ValueError: Lengths must match to compare
Debugging

streamlit_leisure 진행중 에러(3) - ValueError: Lengths must match to compare

2022. 12. 22. 17:25

https://github.com/reodinas/streamlit_leisure

프로젝트 진행 중 발생한 문제 해결 과정을 기록한 포스트입니다.

 

 

유저에게 선택을 받아 선택받은 데이터만을 보여주는 기능을 구현하다 또 이 에러가 발생했다.

주피터 노트북에서 테스트 할 때는 잘 됐었기 때문에 잠시 헤맸는데,

결론은 박스 친 코드가 문제였다.

 

 

selected group2가 하나의 문자열일 때는 문제가 없었지만,

st.multiselect로 입력 받은 값은 리스트가 되기 때문에 

문자열이 리스트와 같냐고 물어본 꼴이다. 따라서 짝이 맞지 않다고 에러가 뜬다.

 

이 버그를 수정하기 위해 박스 친 부분의 코드를 apply 함수를 사용해 다음과 같이 바꿔주었다.

df_new = df[df[selected_group].apply(lambda x: x in selected_group2)][selected_col]

'Debugging' 카테고리의 다른 글

git pull 에러 - error: Your local changes to the following files would be overwritten by merge  (0) 2022.12.23
streamlit_kmeans 진행중 에러 - UnicodeDecodeError  (0) 2022.12.23
streamlit_kmeans 진행중 경고 - UserWarning  (0) 2022.12.23
streamlit_leisure 진행중 에러(2) - DuplicateWidgetID  (0) 2022.12.20
streamlit_leisure 진행중 에러(1) - ValueError: Lengths must match to compare  (0) 2022.12.20
    'Debugging' 카테고리의 다른 글
    • streamlit_kmeans 진행중 에러 - UnicodeDecodeError
    • streamlit_kmeans 진행중 경고 - UserWarning
    • streamlit_leisure 진행중 에러(2) - DuplicateWidgetID
    • streamlit_leisure 진행중 에러(1) - ValueError: Lengths must match to compare
    드레:
    드레:

    티스토리툴바