SomeOne
SomeOne

Reputation: 497

How to add only index column in a given dataframe

Assume the dataframe looks like:

    Alpha   Num
0   A   65
1   B   66 
2   C   67 
3   D   68 
4   E   69 
5   F   70

Here index is from 0 to 5 and he sum of index column is 15.

So how to add the index only & get the sum 15.

Upvotes: 1

Views: 49

Answers (1)

mullinscr
mullinscr

Reputation: 1748

Try:

df.index.to_series().sum()

Upvotes: 1

Related Questions