Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
list from excel
#1
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]

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)  
Reply


Messages In This Thread
list from excel - by devilonline - Jun-22-2022, 02:10 AM
RE: list from excel - by snippsat - Jun-22-2022, 08:49 AM
RE: list from excel - by devilonline - Jun-22-2022, 10:34 PM
RE: list from excel - by snippsat - Jun-22-2022, 10:46 PM
RE: list from excel - by devilonline - Jun-22-2022, 11:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Search Excel File with a list of values huzzug 4 1,287 Nov-03-2023, 05:35 PM
Last Post: huzzug
  trouble reading string/module from excel as a list popular_dog 0 439 Oct-04-2023, 01:07 PM
Last Post: popular_dog
  Compare two Excel sheets with Python and list diffenrences dmkfon 1 14,703 Oct-09-2021, 03:30 PM
Last Post: Larz60+
Question How to make a 3D List of Excel Spreadsheets? chatguy 4 2,775 Jan-24-2021, 05:24 AM
Last Post: buran
  Convert Excel to complex list and2handles 1 2,072 Jun-23-2020, 01:51 PM
Last Post: DPaul
  Trying to color an excel row based on list curranjohn46 2 6,599 May-19-2020, 10:35 AM
Last Post: KavyaL
  How to list out specific excel files ajay_pal7 2 2,853 Mar-10-2020, 05:43 AM
Last Post: Larz60+
  Exporting list with dictionary to Excel veromi22 0 3,064 Oct-15-2019, 12:54 AM
Last Post: veromi22
  Is it possible to access and list all macro names in an excel file? kwfine 0 2,467 Feb-07-2018, 04:21 PM
Last Post: kwfine
  Excel Column as List champk 2 10,509 Jan-03-2018, 11:30 PM
Last Post: karaokelove

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020