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
#1
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”.

İmage


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"
         continue
 		
 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 = 10.1.2.1/30” 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.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  my openpyxl use is too slow, am I reading rows incorrectly? Clunk_Head 1 79 Jun-12-2019, 11:48 PM
Last Post: Clunk_Head
  Mysql returning number of rows not data AkaAndrew123 4 294 Jun-10-2019, 02:31 PM
Last Post: AkaAndrew123
  Pandas find the most often rows dervast 1 64 Jun-07-2019, 01:55 PM
Last Post: ichabod801
  How to iterate over the pandas rows SriMekala 3 158 Jun-04-2019, 12:36 PM
Last Post: SriMekala
  How to convert rows to columns. jarrod0987 1 107 May-15-2019, 02:58 AM
Last Post: scidam
  How to combine two float64 column vector? dsarica 1 104 Apr-17-2019, 07:22 PM
Last Post: Yoriz
  How get row index of matching row in column 0 Sri 7 229 Apr-10-2019, 08:26 PM
Last Post: perfringo
  How to add new rows to existing csv file Sri 1 141 Apr-08-2019, 05:49 PM
Last Post: Larz60+
  How to group by name and column in box plot SriRajesh 0 117 Mar-19-2019, 02:33 PM
Last Post: SriRajesh
  shifting specific column to before/after specific column in dataframe theinzawoo 4 205 Mar-19-2019, 10:55 AM
Last Post: scidam

Forum Jump:


Users browsing this thread: 1 Guest(s)