擅长:python、mysql、java
<p>使用<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.shift.html" rel="noreferrer">^{<cd1>}</a>并比较:</p>
<pre><code>dataframe['changed'] = dataframe['ColumnB'] == dataframe['ColumnB'].shift(1).fillna(dataframe['ColumnB'])
</code></pre>