[英]matplotlib/seaborn heatmap using pandas dataframe with datetime index
[英]Matplotlib heatmap using pandas dataframe
我想使用 matplolib 和這個pandas
dataframe 生成熱圖:
class time day
0 URxvt 2 6
1 Emacs 3 6
2 Firefox 90 6
3 KeePassXC 5 6
4 URxvt 91 6
.. ... ... ...
144 Matplotlib 1 1
145 Matplotlib 1 1
146 Matplotlib 2 1
147 Matplotlib 5 1
148 Matplotlib 93 1
[149 rows x 3 columns]
我想在 x 軸上生成日期(從 0 到 6(但暫時為 0、1 和 6))和在 y 軸上生成 class 的熱圖,值是根據 class 和天的總和)。 我試圖對產生的這兩列進行groupby
:
time
class day
Emacs 0 1149
1 130
6 634
Eog 1 83
6 66
Evince 0 775
6 60
File-roller 0 40
Firefox 0 32109
1 6344
6 9887
GParted 1 25
Gedit 0 77
1 7
Gimp-2.10 6 25
Gmpc 1 73
Gnome-disks 1 21
Gtk-recordmydesktop 0 57
Gufw.py 6 100
KeePassXC 0 44
1 17
6 126
Matplotlib 1 151
Org.gnome.Nautilus 0 141
1 559
6 68
Scangearmp2 6 28
Totem 0 12
URxvt 0 346
1 488
6 3364
vlc 0 22
但我無法獲得正確的熱圖(使用 X:day Y:class 和值:時間)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.