-3
dict = {a : {aa:1, bb:2, cc:3}, b: {aa:1, bb:2, cc:3}}

I want to turn this dictionary into a tab delimited file like this:

       aa  bb  cc
   a   1   2   3
   b   1   2   3

How should I do this. Thanks

Sepjan
  • 1
  • 3

1 Answers1

0

The following will work

import pandas as pd
pd.DataFrame(dict).T.to_csv('sample.tsv', sep='\t')
Jeril
  • 7,858
  • 3
  • 52
  • 69