擅长:python、mysql、java
<p>您可以使用<a href="https://pandas.pydata.org/docs/reference/api/pandas.json_normalize.html" rel="nofollow noreferrer">^{<cd1>}</a>将json/dict扩展为列,然后使用<a href="https://pandas.pydata.org/docs/reference/api/pandas.concat.html" rel="nofollow noreferrer">^{<cd2>}</a>连接回原始数据帧:</p>
<pre><code>pd.concat([df.drop(columns='Adress'), pd.json_normalize(df['Adress'])], axis=1)
name city district
0 Joan Rio Leme
1 Joan Sao Paulo Bras
2 Vincent Recife Caxanga
</code></pre>
<p>请注意,使用<code>pd.json_normalize()</code>将json/dict扩展到列比使用.apply(pd.Series())进行扩展要高效得多</p>