1. Învăţa
  2. /
  3. Courses
  4. /
  5. pandas로 효율적인 코드 작성하기

Connected

exercise

.apply()로 행 반복 처리

.apply() is a very useful to iterate through the rows of a DataFrame and apply a specific function.

You will work on a subset of the poker_hands dataset, which includes only the rank of all the five cards of each hand in each row (this subset is generated for you in the script). You're going to get the variance of every hand for all ranks, and every rank for all hands.

Instrucțiuni 1 / 2

undefined XP
  • 1
    • numpy 패키지를 사용해 분산을 반환하는 lambda 함수를 정의하세요.
    • 이 변환을 모든 행에 적용하세요.
  • 2
    • 모든 랭크에 함수를 적용하도록 스크립트를 수정하세요.