I have a dataframe like so:
Name A B C D E
Date
2000-10-19 Pete 1 0 1 1 0
2000-10-20 Joan 1 1 0 0 1
2000-10-23 Michael 0 0 1 0 1
2000-10-24 Carl 0 1 1 1 1
2000-10-25 Levis 1 0 1 1 0
2000-10-26 Susan 0 0 0 1 1
And I would like to count the "1" for each row, så it look like this:
Name A B C D E F
Date
2000-10-19 Pete 1 0 1 1 0 3
2000-10-20 Joan 1 1 0 0 1 3
2000-10-23 Michael 0 0 1 0 1 2
2000-10-24 Carl 0 1 1 1 1 4
2000-10-25 Levis 1 0 1 1 0 3
2000-10-26 Susan 0 0 0 1 1 2
I think it can be done easily but Numpy, but I can't quite figure out how
But I've come up with this, now I just have to specify which columns it is to be summed on
df['E'] = np.sum(df, axis=1)
Can anybody help