Sample Data frame :
import pandas as pd
idx = pd.MultiIndex.from_product([['Microsoft', 'Google', 'Apple'],
['OS', 'Web']],
names=['Brand', 'Metric'])
col = ['Count']
df = pd.DataFrame(10, idx, col)
df
the data looks like this
When I download it as csv then it download like
df.to_csv('example.csv')
My Requirement is to download this data as pivot table, I am not able to find any way to move the second index as column name, the desired output of data looks like this


