1

I have following dataframe named 'df'

       h      w    x      y
5   21.0  208.0  7.0  270.0
20  34.0  209.0  0.0  158.0

I want to get a single cell out of this dataframe. Forthat I did:

X=df.x
print(X)

This is how x in data frame appears when I do df.x

5     7.0
20    0.0

My expected output is.

7.0
0.0

How do I get my expected output? Please note: (I referred to https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.at.html and found out that by doing df.at[5, 'x'] I can get the values. But I donot want this as I will have to manually enter 5 the index of the row each time to get the value of x I want somethig wich will output value of x as it is without appending any other number to it)

Ajinkya
  • 1,797
  • 3
  • 24
  • 54

0 Answers0