pandas.DataFrame.plot.bar
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(5, 4).round(1),
index=['snail', 'pig', 'elephant','rabbit', 'giraffe'],
columns=pd.Index(['speed', 'lifespan', 'active', 'cuite'],
name='Genus'))
ax = df.plot(kind='bar',figsize=(10,4), rot = 0)
plt.show()
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.rand(5, 4).round(1),
index=['snail', 'pig', 'elephant','rabbit', 'giraffe'],
columns=pd.Index(['speed', 'lifespan', 'active', 'cuite'],
name='Genus'))
ax = df.plot(kind='bar',figsize=(10,4), rot = 0)
plt.show()
==> output in Pycharm

评论
发表评论