Skip to Content
Pythonによるデータ分析入門 第3版 ―pandas、NumPy、Jupyterを使ったデータ処理
book

Pythonによるデータ分析入門 第3版 ―pandas、NumPy、Jupyterを使ったデータ処理

by Wes McKinney, 瀬戸山 雅人, 小林 儀匡
August 2023
Intermediate to advanced
612 pages
9h 33m
Japanese
O'Reilly Japan, Inc.
Content preview from Pythonによるデータ分析入門 第3版 ―pandas、NumPy、Jupyterを使ったデータ処理

10章データの集約とグループ操作

 データをカテゴライズしてグループごとに関数を適用するという作業は、目的が集約であっても変換であっても、データ分析のワークフローの中で最も重要な部分となります。というのも、データを読み込み、マージし準備した後には、グループごとの統計計算を行うことや、(場合によっては)レポーティングや可視化のためにピボットテーブルを使うことが発生するからです。pandasは柔軟なgroupbyインタフェースを持っており、これを利用することで、データセットを自然な方法で小分けして集約することが可能です。

 リレーショナルデータベースとSQL(「構造化問い合わせ言語」(Structured Query Language)の略)が一般的なのは、データの連結やフィルタリング、変換、集約が容易だからです。しかし、SQLのようなクエリ言語では、実現できるグループ操作にある程度制約が生まれてしまいます。それに対して、この後見ていくようにPythonとpandasの表現力を使えば、各グループの紐付くデータを操作するカスタムPython関数として演算を表現できるため、より複雑なグループ操作が行えます。この章では、次に挙げる処理の実現方法を学びます。

  • pandasのオブジェクトを1つあるいは複数のキー(関数や配列、データフレームの列名の形式で指定)を使って分割する方法。
  • グループの要約統計量の計算方法。具体的には、個数のカウント、平均値、標準偏差や、ユーザが定義した関数などの計算方法。
  • グループ内の変換やその他のデータ操作(正規化、線形回帰、順位、部分集合の選択)。
  • ピボットテーブルとクロス集計の計算。
  • 分位点分析やその他のデータから生成されたグループに関する分析。
時系列データの時間に基づく集約は、 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

scikit-learn、Keras、TensorFlowによる実践機械学習 第3版

scikit-learn、Keras、TensorFlowによる実践機械学習 第3版

Aurélien Géron, 下田 倫大, 牧 允皓, 長尾 高弘
Pythonによるデータ分析入門 第2版 ―NumPy、pandasを使ったデータ処理

Pythonによるデータ分析入門 第2版 ―NumPy、pandasを使ったデータ処理

Wes McKinney, 瀬戸山 雅人, 小林 儀匡, 滝口 開資

Publisher Resources

ISBN: 9784814400195Other