'python merge df of scraping

i need your help to join two data frame of two sector table scrapings

the sample url of many is http://www.mercadopublico.cl/Procurement/Modules/RFB/DetailsAcquisition.aspx?idlicitacion=4593-2-L122

for i in popup_linkz:  # set end at 121` so it will use `120`, if you set end at `120` then it will finish on `80` # eliminate and make the url equal to i to test
    
        url=i
          
        soup = BeautifulSoup(requests.get(i).content, "html.parser")
        licitation_number = soup.select_one("#lblNumLicitacion").text
        responsable = soup.select_one("#lblResponsable").text
        ficha = soup.select_one("#lblFicha2Reclamo").text
        nombre_licitacion=soup.select_one("#lblNombreLicitacion").text
       
        #print(f"{licitation_number=}")
        #print(f"{responsable=}")
        #print(f"{ficha=}")
        #print(f"{nombre_licitacion=}")
        #print(f"#lblFicha1Tipo")
        #print("-" * 80)
        
        for t in soup.select("#grvProducto .borde_tabla00"):
            categoria = t.select_one('[id$="lblCategoria"]').text
            candidad = t.select_one('[id$="lblCantidad"]').text
            descripction = t.select_one('[id$="lblDescripcion"]').text
            #print(f"{categoria=} {candidad=}")
            results.append( (licitation_number, responsable, ficha, nombre_licitacion,categoria,candidad,descripction)) 
            #print()
       
        for z in soup.select("#Ficha1 .tabla_ficha_00"): 
             monto=z.select_one('[id$="lblFicha1Tipo"]').text
             estado=z.select_one('[id$="lblFicha1TituloEstado"]').text
             #comuna=z.select_one('[id$="lblFicha2TituloComuna"]').text
             results2.append( (monto,estado) )
             print('results')   
             print(f"{monto=}")
             
    import pandas as pd
    df1=results
    df2=results2
    df3=pd.merge(results,results2)
    df = pd.DataFrame(data = results[1:],columns = results[0])
    df.to_excel('licitaciones1.xlsx', index=False,header = False)#Writing to Excel file 

i am getting this error

TypeError: Can only merge Series or DataFrame objects, a <class 'list'> was passed

not sure why but im trying to solve but not so good so far...

so if you can help me i would be really glad

results look like these

results

results2 like these

enter image description here



Solution 1:[1]

just had to extract the unique value before on the first part sorry for the question I will not delete it since maybe is helpulf for someone

url=i

    soup = BeautifulSoup(requests.get(i).content, "html.parser")
    licitation_number = soup.select_one("#lblNumLicitacion").text
    responsable = soup.select_one("#lblResponsable").text
    ficha = soup.select_one("#lblFicha2Reclamo").text
    nombre_licitacion=soup.select_one("#lblNombreLicitacion").text
    monto=soup.select_one("#lblFicha1Tipo").text# here is the answer
    #print(f"{licitation_number=}")
    #print(f"{responsable=}")
    #print(f"{ficha=}")
    #print(f"{nombre_licitacion=}")
    #print(f"#lblFicha1Tipo")
    #print("-" * 80)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kcomarks