-1

So currently, I ask the user for the column name input and the row input but I don't know how to get the cell value.

import pandas as pd 

data_column = input("what column do you want to choose")
print(data_column)
data_row = input("What row do you want to choose")
print(data_row)

I have tried with iloc and loc but it doesn't return the cell value.

tete
  • 21
  • 4
  • 2
    Can you post your code? – SKPS Jan 21 '20 at 00:40
  • The second section of the user guide is titled "Indexing and Selecting Data" https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html – Paul H Jan 21 '20 at 00:56
  • _I have tried with iloc and loc but it doesn't return the cell value._ That's too vague. This seems like an extremely basic question, have you actually done any research? – AMC Jan 21 '20 at 02:12
  • Does this answer your question? [How to get a value from a cell of a dataframe?](https://stackoverflow.com/questions/16729574/how-to-get-a-value-from-a-cell-of-a-dataframe) – AMC Jan 21 '20 at 02:14

1 Answers1

1

You should be able to get the value of a specific cell by using

data_table.iloc[data_row, data_column] 

Remember that

input("x")

returns a string, so you'd have to cast it into an int if you want to use the variable directly.

data_column = int(input("what column do you want to choose"))
Lapis Rose
  • 644
  • 3
  • 15