File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -205,8 +205,12 @@ simple datetime calculations.
205
205
There are two Timedelta units ('Y', years and 'M', months) which are treated
206
206
specially, because how much time they represent changes depending
207
207
on when they are used. While a timedelta day unit is equivalent to
208
- 24 hours, there is no way to convert a month unit into days, because
209
- different months have different numbers of days.
208
+ 24 hours, month and year units cannot be converted directly into days
209
+ without using 'unsafe' casting.
210
+
211
+ The `numpy.ndarray.astype ` method can be used for unsafe
212
+ conversion of months/years to days. The conversion follows
213
+ calculating the averaged values from the 400 year leap-year cycle.
210
214
211
215
.. admonition :: Example
212
216
@@ -220,6 +224,7 @@ different months have different numbers of days.
220
224
File "<stdin>", line 1, in <module>
221
225
TypeError: Cannot cast NumPy timedelta64 scalar from metadata [Y] to [D] according to the rule 'same_kind'
222
226
227
+
223
228
Datetime units
224
229
==============
225
230
You can’t perform that action at this time.
0 commit comments