要約統計量

次のコードで空欄になっている行に入る適切な選択肢を 1 ~ 3 から選び、下記の設問に答えてください.

Q1:変数 df の “Japana” 列の平均値、標準偏差、最大値を求めて変数 de_description に代入してください.

import pandas as pd
import numpy as np

np.randomseed(0)
cols = [“Japan”, “China”, “USA”, “Germany”, “Russia”]
df = pd.DataFrame()

for col in cols:
df[col] = np.random.choice(range(1, 11), 10)
df.index = range(1, 11)

# Q1
df_description = ##########
print(df_description)

[Q1の選択肢]
1. df[“Japan”].describe().loc[[“mean”, “std”, “max”]]
2. df[“Japan”].describe().at[[“mean”, “std”, “max”]]
3. df.describe().loc[“USA”, [“mean”, “std”, “max”]]

Leave a comment

Your email address will not be published. Required fields are marked *