This is an error in the process of making a graph using a table.
First, I make a table t1
.
t1=join_data.pivot_table(index='payment_ym', columns='registration_ym', values='quantity', aggfunc='sum', fill_value=0)
Then, in registrsation_ym
, the dates were grouped into a larger range. enter image description here
t1['19.01-19.02']=t1['2019-01']+t1['2019-02']
...
t2=t1[['19.01-19.02','19.03-19.04','19.05-19.07' ]]
And i reset the t2
's index.
So, t2
have two columns payment_ym
,registration_ym
. enter image description here
t2.plot(x='payment_ym', y=(['19.01-19.02', '19.03-19.04', '19.05-19.07']), kind='bar')
I want to make a bar chart like this one.
So, i try to use this code.
t2.plot(x='payment_ym', y=(['19.01-19.02', '19.03-19.04', '19.05-19.07']), kind='bar')
But it has an error. TypeError:string indices must be integers
.
I don't know the reason. How can i resolve this?