@@ -577,14 +577,12 @@ def to_datetime(
577
577
578
578
Parameters
579
579
----------
580
- arg : int, float, str, datetime, list, tuple, 1-d array, Series
581
- or DataFrame/dict-like
582
-
580
+ arg : int, float, str, datetime, list, tuple, 1-d array, Series DataFrame/dict-like
581
+ The object to convert to a datetime.
583
582
errors : {'ignore', 'raise', 'coerce'}, default 'raise'
584
-
585
- - If 'raise', then invalid parsing will raise an exception
586
- - If 'coerce', then invalid parsing will be set as NaT
587
- - If 'ignore', then invalid parsing will return the input
583
+ - If 'raise', then invalid parsing will raise an exception.
584
+ - If 'coerce', then invalid parsing will be set as NaT.
585
+ - If 'ignore', then invalid parsing will return the input.
588
586
dayfirst : bool, default False
589
587
Specify a date parse order if `arg` is str or its list-likes.
590
588
If True, parses dates with the day first, eg 10/11/12 is parsed as
@@ -605,7 +603,6 @@ def to_datetime(
605
603
Return UTC DatetimeIndex if True (converting any tz-aware
606
604
datetime.datetime objects as well).
607
605
box : bool, default True
608
-
609
606
- If True returns a DatetimeIndex or Index-like object
610
607
- If False returns ndarray of values.
611
608
@@ -615,17 +612,17 @@ def to_datetime(
615
612
respectively.
616
613
617
614
format : str, default None
618
- strftime to parse time, eg "%d/%m/%Y", note that "%f" will parse
615
+ The strftime to parse time, eg "%d/%m/%Y", note that "%f" will parse
619
616
all the way up to nanoseconds.
620
617
See strftime documentation for more information on choices:
621
- https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
618
+ https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior.
622
619
exact : bool, True by default
623
-
620
+ Behaves as:
624
621
- If True, require an exact format match.
625
622
- If False, allow the format to match anywhere in the target string.
626
623
627
624
unit : str, default 'ns'
628
- unit of the arg (D,s,ms,us,ns) denote the unit, which is an
625
+ The unit of the arg (D,s,ms,us,ns) denote the unit, which is an
629
626
integer or float number. This will be based off the origin.
630
627
Example, with unit='ms' and origin='unix' (the default), this
631
628
would calculate the number of milliseconds to the unix epoch start.
@@ -652,11 +649,12 @@ def to_datetime(
652
649
.. versionadded:: 0.23.0
653
650
654
651
.. versionchanged:: 0.25.0
655
- - changed default value from False to True
652
+ - changed default value from False to True.
656
653
657
654
Returns
658
655
-------
659
- ret : datetime if parsing succeeded.
656
+ datetime
657
+ If parsing succeeded.
660
658
Return type depends on input:
661
659
662
660
- list-like: DatetimeIndex
@@ -712,10 +710,10 @@ def to_datetime(
712
710
4 3/12/2000
713
711
dtype: object
714
712
715
- >>> %timeit pd.to_datetime(s,infer_datetime_format=True) # doctest: +SKIP
713
+ >>> %timeit pd.to_datetime(s, infer_datetime_format=True) # doctest: +SKIP
716
714
100 loops, best of 3: 10.4 ms per loop
717
715
718
- >>> %timeit pd.to_datetime(s,infer_datetime_format=False) # doctest: +SKIP
716
+ >>> %timeit pd.to_datetime(s, infer_datetime_format=False) # doctest: +SKIP
719
717
1 loop, best of 3: 471 ms per loop
720
718
721
719
Using a unix epoch time
0 commit comments