-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PR09 batch 4 #29466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR09 batch 4 #29466
Changes from 15 commits
020e253
1d29e3c
22df300
bfcfdcb
ff6d420
0073196
3763e46
fdfbdf0
e6935f2
83c3970
a1bd208
8888d53
25b48c2
6cf6bf3
afded0c
378c6bb
fa8bb16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,14 +577,13 @@ def to_datetime( | |
|
||
Parameters | ||
---------- | ||
arg : int, float, str, datetime, list, tuple, 1-d array, Series | ||
or DataFrame/dict-like | ||
|
||
arg : int, float, str, datetime, list, tuple, 1-d array, Series DataFrame/dict-like | ||
The object to convert to a datetime. | ||
errors : {'ignore', 'raise', 'coerce'}, default 'raise' | ||
|
||
- If 'raise', then invalid parsing will raise an exception | ||
- If 'coerce', then invalid parsing will be set as NaT | ||
- If 'ignore', then invalid parsing will return the input | ||
Behaves as: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this required to get validation to work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can remove all this. The new version of the script doesn't fail if the description starts with a list. And we'll move to the new version of the script soon. |
||
- If 'raise', then invalid parsing will raise an exception. | ||
- If 'coerce', then invalid parsing will be set as NaT. | ||
- If 'ignore', then invalid parsing will return the input. | ||
dayfirst : bool, default False | ||
Specify a date parse order if `arg` is str or its list-likes. | ||
If True, parses dates with the day first, eg 10/11/12 is parsed as | ||
|
@@ -605,7 +604,7 @@ def to_datetime( | |
Return UTC DatetimeIndex if True (converting any tz-aware | ||
datetime.datetime objects as well). | ||
box : bool, default True | ||
|
||
Behaves as: | ||
- If True returns a DatetimeIndex or Index-like object | ||
- If False returns ndarray of values. | ||
|
||
|
@@ -615,17 +614,17 @@ def to_datetime( | |
respectively. | ||
|
||
format : str, default None | ||
strftime to parse time, eg "%d/%m/%Y", note that "%f" will parse | ||
The strftime to parse time, eg "%d/%m/%Y", note that "%f" will parse | ||
all the way up to nanoseconds. | ||
See strftime documentation for more information on choices: | ||
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior | ||
https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior. | ||
exact : bool, True by default | ||
|
||
Behaves as: | ||
- If True, require an exact format match. | ||
- If False, allow the format to match anywhere in the target string. | ||
|
||
unit : str, default 'ns' | ||
unit of the arg (D,s,ms,us,ns) denote the unit, which is an | ||
The unit of the arg (D,s,ms,us,ns) denote the unit, which is an | ||
integer or float number. This will be based off the origin. | ||
Example, with unit='ms' and origin='unix' (the default), this | ||
would calculate the number of milliseconds to the unix epoch start. | ||
|
@@ -652,11 +651,12 @@ def to_datetime( | |
.. versionadded:: 0.23.0 | ||
|
||
.. versionchanged:: 0.25.0 | ||
- changed default value from False to True | ||
- changed default value from False to True. | ||
|
||
Returns | ||
------- | ||
ret : datetime if parsing succeeded. | ||
datetime | ||
If parsing succeeded. | ||
Return type depends on input: | ||
|
||
- list-like: DatetimeIndex | ||
|
@@ -712,10 +712,10 @@ def to_datetime( | |
4 3/12/2000 | ||
dtype: object | ||
|
||
>>> %timeit pd.to_datetime(s,infer_datetime_format=True) # doctest: +SKIP | ||
>>> %timeit pd.to_datetime(s, infer_datetime_format=True) # doctest: +SKIP | ||
100 loops, best of 3: 10.4 ms per loop | ||
|
||
>>> %timeit pd.to_datetime(s,infer_datetime_format=False) # doctest: +SKIP | ||
>>> %timeit pd.to_datetime(s, infer_datetime_format=False) # doctest: +SKIP | ||
1 loop, best of 3: 471 ms per loop | ||
|
||
Using a unix epoch time | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.