擅长:python、mysql、java
<p>您可以像<code>df.T.plot.bar()</code>那样绘制转置后的数据帧。在</p>
<pre><code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame(np.arange(12).reshape(2,6),columns=list("ABCDEF"))
df.T.plot.bar()
plt.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/yAbrn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yAbrn.png" alt="enter image description here"/></a></p>
<p>使用seaborn,这需要重塑(“融化”)数据帧:</p>
^{pr2}$
<p><a href="https://i.stack.imgur.com/d0Spm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d0Spm.png" alt="enter image description here"/></a></p>