2
說我有以下數據框:順序組內列舉的大熊貓
date A B C D
0 2014-03-20 -1.561714 0.979202 -0.454935 -0.629215
1 2014-03-20 0.390851 0.045697 -1.683257 -0.771027
2 2014-03-20 0.357208 -0.207104 1.949936 -0.752096
3 2014-03-21 0.920687 -2.168321 0.337211 -0.638050
4 2014-03-21 -1.242688 0.541613 0.888365 -1.777855
5 2014-03-21 -0.425210 -1.876906 -0.805386 1.213882
6 2014-03-21 0.166220 -0.153913 -0.156115 0.155276
7 2014-03-22 -0.606291 0.574996 -0.139612 0.896219
8 2014-03-22 1.397973 -1.533777 1.319217 -0.292872
9 2014-03-22 -0.570876 -0.029911 2.143281 -0.515672
我想補充一點,每個日期組中列舉行一列。
以上應該成爲:
date A B C D date_indexer
0 2014-03-20 -1.561714 0.979202 -0.454935 -0.629215 0
1 2014-03-20 0.390851 0.045697 -1.683257 -0.771027 1
2 2014-03-20 0.357208 -0.207104 1.949936 -0.752096 2
3 2014-03-21 0.920687 -2.168321 0.337211 -0.638050 0
4 2014-03-21 -1.242688 0.541613 0.888365 -1.777855 1
5 2014-03-21 -0.425210 -1.876906 -0.805386 1.213882 2
6 2014-03-21 0.166220 -0.153913 -0.156115 0.155276 3
7 2014-03-22 -0.606291 0.574996 -0.139612 0.896219 0
8 2014-03-22 1.397973 -1.533777 1.319217 -0.292872 1
9 2014-03-22 -0.570876 -0.029911 2.143281 -0.515672 2
如何做到這一點的大熊貓有什麼想法?