I have this dataframe:
FamilyVsWWTotal = pd.DataFrame({'date':['2011-4-3','2011-3-5','2011-4-3','2011-5-7'], 'Country':['USA','CAN','USA','MEX']})
So it will have following output:
date Country
2011-4-3 USA
2011-3-5 CAN
2011-4-3 USA
2011-5-7 MEX
And then below code is 2 created table 1:
Table1=FamilyVsWWTotal
Table1['Region']='K'
Hence the Table1 will have following output:
date Country Region
2011-4-3 USA K
2011-3-5 CAN K
2011-4-3 USA K
2011-5-7 MEX K
For the second table which is Table2:
Table2=FamilyVsWWTotal
Table2['aveAge']=60
Hence Table2 output should be like this:
date Country aveAge
2011-4-3 USA 60
2011-3-5 CAN 60
2011-4-3 USA 60
2011-5-7 MEX 60
But I always face this problem which is the Table2output will be look like this which already mix up the code from the above:
Table2
date Country Region aveAge
2011-4-3 USA K 60
2011-3-5 CAN K 60
2011-4-3 USA K 60
2011-5-7 MEX K 60
Anyone can give some ideas how to solve this issue?