# Pandas応用 (Data Science & ML) > GroupBy、merge、concat、pivot tables、time series、apply/transform、MultiIndex、パフォーマンス - 24 面接問題 - Mid-Level - [面接問題: Data Science & ML](https://sharpskill.dev/ja/technologies/data-science/interview-questions.md) ## 1. groupbyで単一の列に複数の異なる集約関数を適用できるメソッドはどれですか? **回答** agg()(またはaggregate())メソッドは、同じ列に複数の集約関数を適用できます。['sum', 'mean', 'count']のような関数のリストや、列ごとに異なる関数を指定する辞書を渡すことができます。この柔軟性は、単一の操作で包括的な統計レポートを作成するために不可欠です。 ## 2. named aggregation構文を使用してgroupby集約時に結果の列を明示的に命名する方法は? **回答** named aggregation構文では、キーワード引数を介して名前付きタプルを持つagg()を使用します。例: df.groupby('category').agg(total_sales=('sales', 'sum'), avg_price=('price', 'mean'))。このアプローチは、後続の処理を複雑にする可能性のある列のMultiIndexを回避し、明示的で読みやすい列名を生成します。 ## 3. groupbyコンテキストにおけるtransform()とapply()の主な違いは何ですか? **回答** transform()は入力と同じサイズの結果を返し、元のインデックスに整列されており、各行にグループ統計(例: グループ平均)を追加するのに理想的です。apply()はより柔軟で異なるサイズの結果を返すことができますが、一般的に遅いです。グループ正規化やz-score計算などの操作にはtransform()を使用してください。 ## さらに21問利用可能 - 条件を満たすグループだけ(例: 10要素以上のグループ)を保持するためにgroupbyのグループをフィルタリングする方法は? - how='left'とhow='inner'を持つpd.merge()の違いは何ですか? 無料で登録: https://sharpskill.dev/ja/login ## その他のData Science & ML面接トピック - [Pythonの基礎](https://sharpskill.dev/ja/technologies/data-science/interview-questions/python-basics.md): 25問, Junior - [Pythonオブジェクト指向プログラミング](https://sharpskill.dev/ja/technologies/data-science/interview-questions/python-oop.md): 20問, Junior - [Pythonのデータ構造](https://sharpskill.dev/ja/technologies/data-science/interview-questions/python-data-structures.md): 20問, Junior - [Git の基礎](https://sharpskill.dev/ja/technologies/data-science/interview-questions/git-fundamentals.md): 18問, Junior - [SQLの基礎](https://sharpskill.dev/ja/technologies/data-science/interview-questions/sql-basics.md): 20問, Junior - [NumPyの基礎](https://sharpskill.dev/ja/technologies/data-science/interview-questions/numpy-fundamentals.md): 22問, Junior - [Pandasの基礎](https://sharpskill.dev/ja/technologies/data-science/interview-questions/pandas-basics.md): 22問, Junior - [Jupyter & Google Colab](https://sharpskill.dev/ja/technologies/data-science/interview-questions/jupyter-colab.md): 16問, Junior - [SQL Joinsと高度なクエリ](https://sharpskill.dev/ja/technologies/data-science/interview-questions/sql-joins-advanced.md): 22問, Mid-Level - [Matplotlib & Seabornによる可視化](https://sharpskill.dev/ja/technologies/data-science/interview-questions/matplotlib-seaborn.md): 20問, Mid-Level - [Plotlyによるインタラクティブな可視化](https://sharpskill.dev/ja/technologies/data-science/interview-questions/plotly-interactive.md): 18問, Mid-Level - [記述統計](https://sharpskill.dev/ja/technologies/data-science/interview-questions/statistics-descriptive.md): 20問, Mid-Level - [推測統計学](https://sharpskill.dev/ja/technologies/data-science/interview-questions/statistics-inferential.md): 24問, Mid-Level - [Web Scraping](https://sharpskill.dev/ja/technologies/data-science/interview-questions/web-scraping.md): 18問, Mid-Level - [BigQuery & Cloud Data](https://sharpskill.dev/ja/technologies/data-science/interview-questions/bigquery-cloud.md): 18問, Mid-Level - [Feature Engineering](https://sharpskill.dev/ja/technologies/data-science/interview-questions/feature-engineering.md): 22問, Mid-Level - [教師あり機械学習:回帰](https://sharpskill.dev/ja/technologies/data-science/interview-questions/ml-supervised-regression.md): 24問, Mid-Level - [教師あり機械学習:分類](https://sharpskill.dev/ja/technologies/data-science/interview-questions/ml-supervised-classification.md): 24問, Mid-Level - [決定木とアンサンブル](https://sharpskill.dev/ja/technologies/data-science/interview-questions/ml-trees-ensembles.md): 24問, Mid-Level - [教師なしML](https://sharpskill.dev/ja/technologies/data-science/interview-questions/ml-unsupervised.md): 22問, Mid-Level - [MLパイプラインと検証](https://sharpskill.dev/ja/technologies/data-science/interview-questions/ml-pipelines-validation.md): 22問, Mid-Level - [時系列と予測](https://sharpskill.dev/ja/technologies/data-science/interview-questions/time-series-forecasting.md): 22問, Mid-Level - [Deep Learningの基礎](https://sharpskill.dev/ja/technologies/data-science/interview-questions/deep-learning-fundamentals.md): 24問, Senior - [TensorFlow & Keras](https://sharpskill.dev/ja/technologies/data-science/interview-questions/tensorflow-keras.md): 22問, Senior - [CNN と画像分類](https://sharpskill.dev/ja/technologies/data-science/interview-questions/cnn-image-classification.md): 24問, Senior - [RNNとシーケンス](https://sharpskill.dev/ja/technologies/data-science/interview-questions/rnn-sequences.md): 22問, Senior - [TransformersとAttention](https://sharpskill.dev/ja/technologies/data-science/interview-questions/transformers-attention.md): 24問, Senior - [NLPとHugging Face](https://sharpskill.dev/ja/technologies/data-science/interview-questions/nlp-huggingface.md): 24問, Senior - [GenAIとLangChain](https://sharpskill.dev/ja/technologies/data-science/interview-questions/genai-langchain.md): 24問, Senior - [MLOps とデプロイ](https://sharpskill.dev/ja/technologies/data-science/interview-questions/mlops-deployment.md): 24問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/data-science/interview-questions/pandas-advanced