For this dataframe:
t = pd.DataFrame({'a':np.random.randint(1,9,10), 'b':np.random.randint(1,9,10)})
I am trying to create a new columns by doing sum of each row:
t['sum'] = t.sum(axis=1)
but, when I try to retrieve the values by: t.sum.values I get the following error: AttributeError: 'function' object has no attribute 'values'
However, if I just sum the two columns manually t['sum2'] = t.a + t.b I can then get the column value by t.sum2.values without error. Can somebody explain to me what I have done wrong?