擅长:python、mysql、java
<p>您可以使用<code>stack</code>/<code>unstack</code>习惯用法</p>
<pre><code>df.stack().map(dict_map_yn_bool).unstack()
</code></pre>
<p>使用@jezrael的设置</p>
^{pr2}$
<p>那么</p>
<pre><code>df.stack().map(dict_map_yn_bool).unstack()
Station nearby_subway_station
0 False True
1 True False
</code></pre>
<hr/>
<p><strong><em>计时</em></strong><br/>
<em>小数据</em></p>
<p><a href="https://i.stack.imgur.com/583mR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/583mR.png" alt="enter image description here"/></a></p>
<p><em>更大的数据</em></p>
<p><a href="https://i.stack.imgur.com/Z0Ycn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z0Ycn.png" alt="enter image description here"/></a></p>