From ang SQL query, I got a DataFrame similar to this one:
df = pd.DataFrame([
['ABC', 'Order'],
['ABC', 'Address'],
['ABC', 'Zip'],
['XYZ', 'Customer'],
['XYZ', 'Name']
],
columns=("Table", "Column"))
Table Column
0 ABC Order
1 ABC Address
2 ABC Zip
3 XYZ Customer
4 XYZ Name
I am trying to save info in a separate file, like:
Table ABC has columns: Order, Address, Zip
One line for each table (and only once).
How I can achieve this?
I already tried:
for table_name in df.TABLE_NAME:
output = "Table" + Table_name + "are" + (df.iloc[:,2])
But I am not getting any desired output.