擅长:python、mysql、java
<h2>使用<code>defualtdict</code></h2>
<pre><code>from collections import defaultdict
d = defaultdict(dict)
for i, k, v in df1.itertuples(index=False):
d[i][k] = v
pd.DataFrame(dict(zip(df2, [[d[i][k] for k in df2[i]] for i in df2])), df2.index)
GRTYPE CHRTSTAT SECTION
0 Total exclusions 4-year schools Revised cohort Bachelors/ equiv .
1 4-year institutions, Adjusted cohort Exclusions Bachelors/ equiv .
2 4-year institutions, Adjusted cohort Adjusted cohort Bachelors or equiv 2009 .
3 4-year institutions, Completers Revised cohort Bachelors/ equiv .
4 4-year institutions, Completers Exclusions Bachelors or equiv 2009 .
</code></pre>
<hr/>
<h2><code>apply</code></h2>
^{pr2}$