回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>数据如下:</p>
<pre><code>id,outer,inner1,inner2,inner3
123,"Smith,John",a,b,c
123,"Smith,John",d,e,f
123,"Smith,John",g,h,i
456,"Williams,Tim",xx,yy,zz
456,"Williams,Tim",vv,ww,uu
456,"Miller,Ray",rrr,sss,ttt
456,"Miller,Ray",qqq,www,ppp
</code></pre>
<p>我希望生成的词典</p>
^{pr2}$
<p>我尝试调整来自<a href="https://stackoverflow.com/questions/25485681/python-creating-a-nested-dictionary-from-csv-file">Python Creating A Nested Dictionary From CSV File</a>的已接受答案,但此方法在每一行都覆盖字典,因此只有每个id的最后一行才会出现在字典中。在</p>