我想更改数据框结构

时间:2018-09-14 09:22:35

标签: python-3.x pandas dataframe pivot-table

我当前的数据框如下:

CREATED_DATE    STATE
02/03/15 0:00   Texas
02/03/15 0:00   Texas
02/03/17 16:19  Texas
02/03/15 16:19  Florida
02/03/16 16:19  Florida
02/03/16 16:19  Florida
02/03/15 16:19  Alabama
02/03/16 16:19  Alabama
02/03/15 16:19  North Carolina
02/03/15 16:19  North Carolina
02/03/16 16:19  North Carolina

我想将其更改为:

STATE   2015    2016    2017
Texas   2   0   1
Florida 1   2   0
Alabama 1   1   0
North Carolina  2   1   0

0 个答案:

没有答案