How to combine it to single function and append all values to single df
My trials were create df_network inside network function and then create df_memory inside memory function, and then try concatenate two differnt df.
This works
def network():
df_network = pd.DataFrame(
([i.DNSHostName, i.ipaddress] for i in conn.Win_ddd()),
columns=['DNSHostName', 'ipaddress']
)
return df
def memory():
df_memory = pd.DataFrame(
([i.Caption, i.TotalPhysicalMemory] for i in conn.Win_sss()),
columns=['Caption', 'TotalPhysicalMemory']
)
return df
df_network = network()
df_memory = memory()
Something like this but i get error for below trial - If i try in single function
def total():
df = pd.DataFrame(
([i.DNSHostName, i.ipaddress] for i in conn.Win_ddd()),
columns=['DNSHostName', 'ipaddress']
([i.Caption, i.TotalPhysicalMemory] for i in conn.win_sss()),
columns=['Caption', 'TotalPhysicalMemory']
)
return df
df.head()
| DNSHostName | ipaddress | Caption | TotalPhysicalMemory |
|-------------|--------------|---------|---------------------|
| AAA | xx.xx.xxx.xx | RRR | 3434334 |
| BBB | xx.xx.xxx.aa | FFF | 6456456 |