是否可以在熊猫数据框内嵌入条形图?

时间:2019-10-30 23:30:03

标签: python pandas

我正在尝试在此CMU Machine Learning lecture中复制表格/图形。

enter image description here

这是代码

gender = ['Female']*4+['Male']*4
hours_worked = ['v0','v0','v1','v1']*2
hours_worked = np.array([hours_worked])
wealth = np.array(['poor','rich']*4)
ratio = np.array([0.253122 ,0.0245895,0.0421768,0.0116293,0.331313,0.0971295,0.134106,0.105933])
data = np.vstack([gender, hours_worked, wealth, ratio]).T
df = pd.DataFrame(data, columns=['gender', 'hours_worked', 'wealth', 'ratio'])

我有这张桌子

enter image description here

是否可以在表格中嵌入红色条形图?

0 个答案:

没有答案