擅长:python、mysql、java
<p>尝试:</p>
<pre><code># if index not datetime object, then
# df.index = pd.to_datetime(df.index)
>>> pd.Series(df.index).diff().mean().components.minutes
20
#or,
>>> pd.Series(df.index).diff().iloc[-1].components.minutes
20
</code></pre>