使用熊猫在几列上绘制最小值

时间:2020-03-09 21:15:47

标签: python pandas plot

我在pandas数据框中有几列,我想在每一行的几列中绘制最小值。即

np.random.seed(2020)
x = np.random.rand(10,3)
df = pd.DataFrame(x, columns = ["x" , "y", "z"])

我只想绘制以下内容:

plt.hist( min(df['x'], df['y'], df['z']) ) 

1 个答案:

答案 0 :(得分:2)

IIUC,在轴1上使用DataFrame.minSeries.hist方法:

# Set up
np.random.seed(2020)
x = np.random.rand(10,3)
df = pd.DataFrame(x, columns = ["x" , "y", "z"])

df.min(axis=1).hist()

[出]

enter image description here

相关问题