title: How to flatten nested dataclass while serializing to pandas dataframe?
body: <p>I have dataclass containing other dataclass as its field:</p>
  <pre><code>@dataclass
  class Bar:
      abc: int
      bed: int
      asd: int
  
  
  @dataclass
  class Foo:
      xy: int
      yz: Bar
  </code></pre>
  <p>then I try to serialize it to csv by pandas like this:</p>
  <pre><code>dataset = [Foo(xy=1, yz=Bar(abc=1, bed=2, asd=3))]
  pd_dataset = pandas.DataFrame(vars(row) for row in dataset)
  pd_dataset.to_csv('dataset_example.csv', index=False)
  </code></pre>
  <p>but the result I get is kinda different than I want to achieve. To be precise I now get:</p>
  <pre><code>xy,yz
  1,&quot;Bar(abc=1, bed=2, asd=3)&quot;
  </code></pre>
  <p>and I want:</p>
  <pre><code>xy,yz_abc,yz_bed,yz_asd
  1,1,2,3
  </code></pre>
  <p>Can you help me getting it right? I tried to write my own serialization function and do something like:
  <code>pandas.DataFrame(asdict(row, dict_factory=row_to_dict) for row in dataset)</code>
  but I can't get how to correctly write it.</p>