Iterating through 2 dataframes, nested for loop Python. Need help optimizing : I have 2 CSV files. 
One with Hostnames and IPs.
The second with IP information (Netmask, Cidr, Subnet Name etc..)

I currently have a situation like the following.

    for i, ipAddress in CSV1:
           for j, ipNetwork in CSV1:
                 if ipAddress in ipNetwork:
                      append ipNetwork['Subnet Name']

Unfortunately, the first csv has 9000 IPs and the second list has 30'000 subnets. This is taking a huge amount of time to iterate through. I know this was an awful way of implementing this but I knew I could always improve.

Can anyone advise how better I can solve this problem? How can I search through and compare elements in each to shorten the runtime of this script?