【書式】
ライブラリ:pandas,matplotlib,seaborn
書式
sns.distplot(df["列名"],fit=norm,fit_kws={"color":"色"})
plt.show()
【コード】
%matplotlib inline
import matplotlib.pyplot as plt
import japanize_matplotlib
import seaborn as sns
import pandas as pd
import numpy as np
from scipy.stats import norm
df=pd.DataFrame({
"A":np.random.randint(0,100,1500),
"B":np.random.normal(50,10,1500)
})
sns.distplot(df["A"],fit=norm,fit_kws={"color":"red"})
plt.title("偏りのないランダムな値")
plt.show()
sns.distplot(df["B"],fit=norm,fit_kws={"color":"red"})
plt.title("偏りのないランダムな値")
plt.show()
【結果】
`distplot` is a deprecated function and will be removed in seaborn v0.14.0.
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `histplot` (an axes-level function for histograms).
For a guide to updating your code to use the new functions, please see
sns.distplot(df["A"],fit=norm,fit_kws={"color":"red"})
`distplot` is a deprecated function and will be removed in seaborn v0.14.0.
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `histplot` (an axes-level function for histograms).
For a guide to updating your code to use the new functions, please see
sns.distplot(df["B"],fit=norm,fit_kws={"color":"red"})
微妙なメッセージが出たが、現段階では流すことにする。