擅长:python、mysql、java
<p>下面是它在numpy <a href="http://docs.scipy.org/doc/numpy/reference/arrays.datetime.html" rel="nofollow">documentation</a>中所说的:</p>
<blockquote>
<p>There are two Timedelta units (‘Y’, years and ‘M’, months) which are treated specially, because how much time they represent changes depending on when they are used. While a timedelta day unit is equivalent to 24 hours, there is no way to convert a month unit into days, because different months have different numbers of days.</p>
</blockquote>
<p>不过,几天和几周似乎很管用:</p>
<pre><code>dates4 = dates_np + np.timedelta64(1, 'D')
dates5 = dates_np + np.timedelta64(1, 'W')
</code></pre>