I am trying to merge two dataframes together to create one concise dataframe. The first dataframe holds all possible names of various network devices. The second dataframe contains the names of network devices that actually exist, as well as their corresponding hardware.
I need to merge these two dataframes together so that the device names in the first dataframe are "checked" against what exists in the second dataframe, and then spit out the corresponding piece of hardware in order to perform further analysis later.
Here is a simplified illustration of what I have going on:
print(df1)
Router_Name Firewall_Name
0 router1 firewall1
1 router2 firewall2
2 router3 firewall3
3 router4 firewall4
print(df2)
Device_Name Hardware_Platform
0 router2 cisco111
1 router3 cisco222
2 firewall1 cisco333
3 firewall2 cisco444
This would be my desired result after performing a merge:
print (df3)
Router_Name Hardware_Platform Firewall_Name Hardware_Platform
0 router1 N/A firewall1 cisco333
1 router2 cisco111 firewall2 cisco444
2 router3 cisco222 firewall3 N/A
3 router4 N/A firewall4 N/A
I have tried many commands including:
result = pd.concat([df1, df2], axis=1).reindex(df2.index)
print(result)
But this simply results in stacking df1 and df2 on top of each other. Is using this method even possible?