Bottom Page

Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get the info from 2 different rows in the same column using a one key
Hi all,
Again I need your support!
I have the following excel file info:

Using the key “Site ID” I want to find the VLAN XXX about the key1 but if you observe the excel I have 2 rows for the same key1, I have the identification for the first row as “key1” and for the second row it’s blank but nevertheless that row also contains info about “key1”.


this is the coding:
 excel_file = u'*Personal SUR GUL EPT 20190103*'
 controller_file = u'*IPs Controladoras*'
 ip_plan_file = u'*IP PLAN South_2*'
 controller_Dict = LOAD_EXCEL_FILE(controller_file, "Sheet1", 1, "key2")
 ip_plan_Dict = LOAD_EXCEL_FILE(ip_plan_file, "Sheet2", 1, "Site ID")
 Site_2G_Dict = LOAD_EXCEL_FILE(excel_file,"Sheet3", 1, "Site Name")
 Base_Station_row_list = []
 Site_list = READ_TXT_FILE("site_list")
 for sites in Site_list:
     if sites not in Site_2G_Dict.keys(): # Check if SiteID exist in excel file
         print sites, "Not present in Personal excel file"
 Site_2G_Info = Site_2G_Dict[sites]
 h = Site_2G_Info[0].attr("Site ID")
 # Device IP Address info
     for device_ip in ip_plan_Dict:
         if device_ip != h: continue
         device_ipplan_info = ip_plan_Dict[device_ip]
         i = device_ipplan_info[0].attr("IP Address")
with this coding, I can get the IP Address info “i =” but I don’t want the IP I want the VLAN XXX info “i = VLAN 1000”
Thanks in advance
Gribouillis wrote Jan-10-2019, 09:52 PM:
Fixed python tag, see BBCode help.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Remove Rows based on condition abc123 1 83 Jan-12-2019, 10:45 PM
Last Post: Larz60+
  column math Devilish 1 98 Jan-06-2019, 01:38 AM
Last Post: scidam
  How to calculate variance(standard deviation) by column SriRajesh 2 136 Dec-27-2018, 12:35 PM
Last Post: SriRajesh
  Slow loop due to row & column consolidation Etrigan 0 137 Nov-27-2018, 05:06 AM
Last Post: Etrigan
  Print data in rows and columns rlinux57 5 239 Nov-10-2018, 05:50 AM
Last Post: rlinux57
  Bot to get info from one page and save to db sena 0 162 Nov-09-2018, 02:43 PM
Last Post: sena
  How to combine timeseries data under one column? python_newbie09 1 186 Oct-20-2018, 06:51 PM
Last Post: mlieqo
  Insert list in particular column! Help! vndywarhol 0 227 Sep-17-2018, 11:14 PM
Last Post: vndywarhol
  Openpyxl -Coming up with a single column from a multi column data set Givan007 1 278 Sep-07-2018, 04:29 AM
Last Post: Prabakaran141
  Printing lists in a table, rows and columns randy_shooflay 6 439 Sep-05-2018, 07:59 PM
Last Post: perfringo

Forum Jump:

Users browsing this thread: 1 Guest(s)