I have a pandas dataframe constructed from a csv file.
I ask the user for two values, separated by a space.
I then attempt to do a pandas.loc[,] to return that cell value.
How do I match their input to my row columns and return just the raw value of that cell? Impossible in Python? My program works well so far in determining which csv table to look up and how to assign the input to variables. It's the actual passing to the chart lookup that doesn't work. Here is some sample code.
import pandas as pd
A_read = pd.read_csv('My.csv')
A1 = pd.DataFrame(A_read)
A = A1.set_index("Years")
separator = ' '
user_input = raw_input("Enter two values: ").split(separator)
rank = user_input[0]
Years = int(user_input[1])
pay = A.loc[ , ] #problem area
I process the Years input into an int and then input it to a sorting table giving it the value of 'Over 0' or 'Over 5' etc. This string matches the terms in my index like in the example table here. Rank is input as string and no changes are made.
Years E-9 E-8
Over 0 40 80
Over 2 30 20
I only wrote a lot to be clear! Just looking for any solutions that takes inputs and matches them to rows/columns to return a cell.