擅长:python、mysql、java
<p>看来你得先把那些口述弄平。在</p>
<p>首先在列表上应用展平函数:</p>
<pre><code>def flatten_dict(d, prefix='__'):
def items():
# A clojure for recursively extracting dict like values
for key, value in d.items():
if isinstance(value, dict):
for sub_key, sub_value in flatten_dict(value).items():
# Key name should imply nested origin of the dict,
# so we use a default prefix of __ instead of _ or .
yield key + prefix + sub_key, sub_value
else:
yield key, value
return dict(items())
</code></pre>
<p>还要注意orient=records的用法,这意味着列表中的每个dict都是dataframe中的一行。在</p>
<p>所以:</p>
^{pr2}$