Jun-22-2022, 02:10 AM
(This post was last modified: Jun-22-2022, 02:10 AM by devilonline.)
I
I'm trying to search from a excel file. I've make a convert to a dictionary but still didnt work
I want for example search id 1 and print name Charles
can you help me
table from excel file
![[Image: Captura-de-ecr-2022-05-31-133656.png]](https://i.postimg.cc/05WhxBbg/Captura-de-ecr-2022-05-31-133656.png)
I'm trying to search from a excel file. I've make a convert to a dictionary but still didnt work
I want for example search id 1 and print name Charles
can you help me
table from excel file
![[Image: Captura-de-ecr-2022-05-31-133656.png]](https://i.postimg.cc/05WhxBbg/Captura-de-ecr-2022-05-31-133656.png)
import pandas as pd
df = pd.read_excel("book.xlsx")
dict_a = df.to_dict()
search_name = int(input("Provide ID: "))
key_of_value = list(dict_a)[list(dict_a["id"]).index(search_name)]
print(key_of_value)
