0
我想用pandas/matplotlib在此圖的圓圈頂部添加數據標籤。將數據標籤添加到折線圖
的數據被從Excel文件中使用熊貓和「月」作爲索引加載
#Importing the data
Path = 'xyz.xlsx'
df = pd.read_excel(Path,sheetname=0,index_col='Month')
然後我繼續使用以下代碼
plt.plot(df['Sales1'],marker='o',label='Sales')
plt.show()
繪製數據我嘗試了註釋,但無法使其工作。
我的數據框看起來像這樣
Sales1 Sales2 Sales3
Month
2015-08-01 24457 31895 42081
2015-09-01 6926 43584 20666
2015-10-01 4973 4845 10962
2015-11-01 21345 17909 36115
2015-12-01 8639 40668 38215
2016-01-01 48021 18145 25353
2016-02-01 6708 24651 46089
2016-03-01 8827 18617 31215
2016-04-01 49703 14205 26983
2016-05-01 3223 16658 1854
2016-06-01 6484 46503 13523
2016-07-01 41243 18876 20740
2016-08-01 21779 13362 48997
2016-09-01 9494 40242 15477
2016-10-01 1205 10291 32663
2016-11-01 42655 41375 48549
2016-12-01 24644 26002 6602
2017-01-01 33732 44292 45151
2017-02-01 47880 15503 1404
2017-03-01 32499 17755 11135
2017-04-01 42888 31527 25174
2017-05-01 34433 8292 20117
2017-06-01 9884 2359 45424
2017-07-01 35302 24177 48045