我有一個數據幀DF - DF-的Python 3.X - 單槓情節
Source Amount
1 University of Minnesota 119367000
2 Minnesota State Colleges and Universities 159812000
3 Education 7491000
4 Minnesota State Academies 11354000
5 Perpich Center for Arts Education 2000000
6 Natural Resources 63480000
7 Pollution Control Agency 2625000
8 Board of Water and Soil Resources 8000000
9 Agriculture 203000
10 Zoological Garden 12000000
11 Administration 127000000
12 Minnesota Amateur Sports Commission 7973000
13 Military Affairs 3244000
14 Public Safety 4030000
15 Transportation 57263000
16 Metropolitan Council 45968000
17 Human Services 86387000
18 Veterans Affairs 2800000
19 Corrections 11881000
20 Employment and Economic Development 92130000
21 Public Facilities Authority 45993000
22 Housing Finance Agency 20000000
23 Minnesota Historical Society 12002000
24 Bond Sale Expenses 900000
25 Cancellations -10849000
26 TOTAL 893054000
27 Bond Proceeds Fund (General Fund Debt Servic... 814745000
28 Bond Proceeds Fund (User Financed Debt Servi... 39104000
29 State Transportation Fund 36613000
30 Maximum Effort School Loan Fund 5491000
31 Trunk Highway Fund 7950000
32 Bond Proceeds Cancellations -10849000
我想創建一個水平barplot繪製該數據。
import matplotlib.pyplot as plt
plt.barh(expense_df['Amount'],expense['Source'])
plt.show()
但上面這段代碼提供了和錯誤 - TypeError: cannot convert the series to <class 'int'>
如何創建一個水平條形圖?
我怎麼能在Python重建呢?
您發佈的數據,是不是假的,公開或保密的嗎? – gboffi
公共數據。 source- https://www.revisor.mn.gov/laws/?year=2014&type=0&doctype=Chapter&id=294 –