시작하기무료로 시작하기

PySpark DataFrame에서 데이터 살펴보기

그래프 작성, 모델링, 학습 등 분석을 수행하기 전에 데이터를 살펴보는 일은 매우 중요해요. 이 간단한 연습 문제에서는 기본적인 DataFrame 연산자를 사용해 이전 연습에서 만든 people_df DataFrame의 데이터를 살펴보겠습니다.

워크스페이스에는 이미 SparkSession spark와 DataFrame people_df가 준비되어 있어요.

이 연습은 강의의 일부입니다

PySpark로 배우는 빅데이터 기초

강의 보기

연습 안내

  • people_df DataFrame에서 처음 10개의 관측값을 출력하세요.
  • people_df DataFrame의 행 개수를 세세요.
  • people_df DataFrame에는 몇 개의 열이 있으며, 그 열 이름은 무엇인가요?

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Print the first 10 observations 
people_df.____(10)

# Count the number of rows 
print("There are {} rows in the people_df DataFrame.".format(people_df.____()))

# Count the number of columns and print their names
print("There are {} columns in the people_df DataFrame and their names are {}".format(len(people_df.____), people_df.____))
코드 편집 및 실행