0

I'm trying to get the value of the index-column in the last row of a dataframe. How can i get a value and not a series ?

1
  • What do you mean by index-column? Commented Jan 20, 2019 at 14:09

1 Answer 1

2

I believe you need indexing - last value of index:

df = pd.DataFrame({
         'A':[4,5,6,8,2,1],
         'B':list('qwerty')
}, index=list('abcdef'))

print (df)
   A  B
a  4  q
b  5  w
c  6  e
d  8  r
e  2  t
f  1  y

val = df.index[-1]
print (val)
f
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.