@@ -56,8 +56,19 @@ TD64NS_DTYPE = np.dtype('m8[ns]')
56
56
# Unit Conversion Helpers
57
57
58
58
cdef inline int64_t cast_from_unit(object ts, str unit) except ? - 1 :
59
- """ return a casting of the unit represented to nanoseconds
60
- round the fractional part of a float to our precision, p """
59
+ """
60
+ Return a casting of the unit represented to nanoseconds
61
+ round the fractional part of a float to our precision, p.
62
+
63
+ Parameters
64
+ ----------
65
+ ts : int, float, or None
66
+ unit : str
67
+
68
+ Returns
69
+ -------
70
+ int64_t
71
+ """
61
72
cdef:
62
73
int64_t m
63
74
int p
@@ -307,7 +318,7 @@ cdef class _TSObject:
307
318
return self .value
308
319
309
320
310
- cdef convert_to_tsobject(object ts, tzinfo tz, object unit,
321
+ cdef convert_to_tsobject(object ts, tzinfo tz, str unit,
311
322
bint dayfirst, bint yearfirst, int32_t nanos = 0 ):
312
323
"""
313
324
Extract datetime and int64 from any of:
@@ -497,7 +508,7 @@ cdef _TSObject _create_tsobject_tz_using_offset(npy_datetimestruct dts,
497
508
return obj
498
509
499
510
500
- cdef _TSObject _convert_str_to_tsobject(object ts, tzinfo tz, object unit,
511
+ cdef _TSObject _convert_str_to_tsobject(object ts, tzinfo tz, str unit,
501
512
bint dayfirst = False ,
502
513
bint yearfirst = False ):
503
514
"""
@@ -513,6 +524,7 @@ cdef _TSObject _convert_str_to_tsobject(object ts, tzinfo tz, object unit,
513
524
Value to be converted to _TSObject
514
525
tz : tzinfo or None
515
526
timezone for the timezone-aware output
527
+ unit : str or None
516
528
dayfirst : bool, default False
517
529
When parsing an ambiguous date string, interpret e.g. "3/4/1975" as
518
530
April 3, as opposed to the standard US interpretation March 4.
0 commit comments