I have a dataframe named df1
where I have columns col_names = ['issuedate','channel','coupons','revenue']
, and df is looking something like that:
issuedate channel coupons revenue
0 2009-01-01 WWW 9999999 103082.98
1 2010-01-01 Агенты 5 16518.01
2 2010-01-01 КЦ 1 1137.22
3 2010-01-01 С7 Билет 12 55239.87
4 2010-01-01 ТКП 3 16800.00
After, I try to plot counts of channel
s in issuedate
(channel_old is channel, that's not a point :)):
data7 = { "BSP/ARC" : df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'BSP/ARC') ]['issuedate'],
"WWW":df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'WWW') ]['issuedate'],
"Агенты":df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'Агенты') ]['issuedate'],
"КЦ":df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'КЦ') ]['issuedate'],
"Предст":df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'Предст') ]['issuedate'],
"С7 Билет":df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'С7 Билет') ]['issuedate'],
"ТКП":df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'ТКП') ]['issuedate'],
};
dataFrame = pd.DataFrame(data=data7, columns = ["BSP/ARC","WWW","Агенты","КЦ","Предст","С7","Билет","ТКП"], index = pd.date_range(start='01/01/2010', end='01/01/2012', freq='M'))
dataFrame.plot.area(stacked=True);
So as a result I have a empty plot, that is wrong:
Whereas command like:
df1.loc[(df1['issuedate'] >= '01/01/2010') & (df1['issuedate'] <= '01/01/2012') & (df1['channel_old'] == 'С7 Билет') ]['issuedate']
works as right, and gives:
3 2010-01-01
9 2010-01-02
15 2010-01-03
21 2010-01-04
27 2010-01-05
...
4765 2011-12-27
4772 2011-12-28
4779 2011-12-29
4786 2011-12-30
4792 2011-12-31
Name: issuedate, Length: 729, dtype: datetime64[ns]