【发布时间】:2021-03-09 17:09:54
【问题描述】:
我一直试图在子图中绘制我的数据框的所有列,但它不起作用。 有什么聪明的方法吗?
import padas as pd
import seaborn as sns
df = pd.DataFrame({'TR':np.arange(1, 6).repeat(5), 'A': np.random.randint(1, 100,25), 'B': np.random.randint(50, 100,25), 'C': np.random.randint(50, 1000,25), 'D': np.random.randint(5, 100,25), 'E': np.random.randint(5, 100,25),
'F': np.random.randint(5, 100,25), 'G': np.random.randint(5, 100,25), 'H': np.random.randint(5, 100,25), 'I': np.random.randint(5, 100,25), 'J': np.random.randint(5, 100,25) })
row = 2
col = 5
r = sorted(list(range(0, row))*5)
c = list(range(0, col))*2
fig, axes = plt.subplots(row, col, figsize=(20, 10))
for j, k,i in zip( r, c, df.columns):
plt.figure()
g = sns.boxenplot(x = 'TR', y = df[i], ax= axes[j, k], data=df)
plt.show()
【问题讨论】:
标签: python pandas dataframe seaborn