Assign plt.hist() to a value, then the first elemnt is the ys, the second is the xs. a = plt.hist(); ys = a[0]; xs = a[1]
. Then you can write with any method, like pandas.DataFrame.to_csv()
, depending on what structure you want. Keep in mind, the xs
are actually boundaries, starting with the lower bound of the first, ending with the upper bound of the last, so the length of xs
is one greater than the length of ys
.
So for example, if you want just the upper bounds, maybe something like this: pd.DataFrame({'x_upper':a[1][1:], 'y': a[0]}).to_csv(filename)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…