dt=df['dt']
first=df['first']
x=pd.value_counts(pd.to_datetime(df.dt.sum()).strftime('%Y-%m'))
y=pd.value_counts(pd.to_datetime(first.sum()).strftime('%Y-%m'))
x y
2015-01 111 2015-01 654
2015-03 1231 2015-03 315
2015-05 123 2015-05 464
2015-02 456 2015-02 654
. .
. .
x和y有这样的数据
ie)2015-01 =(654/111)* 100
我想像年同月x,y(x / y)* 100
一样计算 y x
((2015-01+2015-02)/2015-02)*100
((2015-01+2015-02+2015-03)/2015-03)*100
2015-02=(654+654/456)*100
2015-03=(654+654+315/1231)*100
like this
I want to put this x and y in dictionary
date is key and number is value
ie) dict={2105-01:111,2015-03:1231......}
答案 0 :(得分:1)