How to stop returning the index and column name when using loc
Question:
I have a tkinter program that connects to a CSV file. I am trying to insert certain values from the CSV file into text boxes in tkinter. I am selecting the values using loc slicing.
The problem I am running into is that my slicing returns the column name and index in addition to the value I want. Because of this, I cannot insert the correct value into my tkinter text box. Can someone help me remove the column name and index from my results?
Code:
ID = Entry6.get()
follow_up_DF = pd.read_csv('file.csv')
name = follow_up_DF.loc[follow_up_DF["Email ID"] == int(ID),["Name"]]
subject=Text(home, height=1)
subject.insert(1.0,(name))
subject.place(x=0, y=400)
Answers:
Try making name equal to this:
name = follow_up_DF.loc[follow_up_DF["Email ID"] == int(ID),["Name"]].value[0][0]
.value should return just the item from the row, not its index and column name.
I have a tkinter program that connects to a CSV file. I am trying to insert certain values from the CSV file into text boxes in tkinter. I am selecting the values using loc slicing.
The problem I am running into is that my slicing returns the column name and index in addition to the value I want. Because of this, I cannot insert the correct value into my tkinter text box. Can someone help me remove the column name and index from my results?
Code:
ID = Entry6.get()
follow_up_DF = pd.read_csv('file.csv')
name = follow_up_DF.loc[follow_up_DF["Email ID"] == int(ID),["Name"]]
subject=Text(home, height=1)
subject.insert(1.0,(name))
subject.place(x=0, y=400)
Try making name equal to this:
name = follow_up_DF.loc[follow_up_DF["Email ID"] == int(ID),["Name"]].value[0][0]
.value should return just the item from the row, not its index and column name.