始める無料で始める

PySpark の DataFrame を調べる

可視化、モデリング、学習などの分析を行う前に、データを確認することはとても重要です。このシンプルな演習では、前の演習で作成した people_df DataFrame を、基本的な DataFrame 演算子を使って確認します。

作業スペースにはすでに SparkSession spark と DataFrame people_df が用意されています。

この演習はコースの一部です

PySparkで学ぶBig Data入門

コースを見る

演習の手順

  • 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.____))
コードを編集して実行