LoginSignup
0
0

More than 1 year has passed since last update.

04.10.Cross Tabulation

Last updated at Posted at 2022-06-13

Cross Tabulation(クロス集計)は主としてカテゴリデータを集計する方法
データの中から複数項目を選んで集計を行う手法

・pd.crosstab(X["A"], X["B"])と書いた場合、Aが縦列、Bが横列となる
・margins=Trueを書くと、総計値のカラムが作成される
pd.crosstab(df[“A”], df[“B”], margins=True)
pd.crosstab(train["marital"], train["y"], margins=True)

#例①
pd.crosstab(df["customer_ENG"], df["Suppliers"], margins=True)

#例②複数アイテムでのクロス集計
pd.crosstab([df["customer_ENG"], df["Suppliers"]], [df["Claim_MFG"], df["Claim_DMG"]], margins=True)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0