擅长:python、mysql、java
<p>使用<a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.str.extractall.html" rel="nofollow noreferrer">Series.str.extractall</a>,然后与原始df连接。你知道吗</p>
<pre><code>sample1.filter(regex='^(?!SPD)').join(
sample1.SPD.str.extractall('(?P<SPD>.{4})').reset_index(level=1, drop=True)
)
# TST RCV TCU SPD
#1 1535840000000 1535840000000 358272000000000 NaN
#2 1535840000000 1535850000000 358272000000000 0000
#2 1535840000000 1535850000000 358272000000000 0000
#2 1535840000000 1535850000000 358272000000000 0000
#2 1535840000000 1535850000000 358272000000000 0071
#2 1535840000000 1535850000000 358272000000000 0000
#2 1535840000000 1535850000000 358272000000000 007D
#2 1535840000000 1535850000000 358272000000000 007C
#2 1535840000000 1535850000000 358272000000000 00E2
</code></pre>
<p>使用内部联接(。。。how='inner')如果要排除少于4个字符的行<code>SPD</code>。你知道吗</p>