You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.17.0.txt
+39
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,45 @@ New features
33
33
Other enhancements
34
34
^^^^^^^^^^^^^^^^^^
35
35
36
+
- ``DatetimeIndex`` can be instantiated using strings contains ``NaT`` (:issue:`7599`)
37
+
- The string parsing of ``to_datetime``, ``Timestamp`` and ``DatetimeIndex`` has been made consistent" (:issue:`7599`)
38
+
39
+
Prior to v0.17.0, ``Timestamp`` and ``to_datetime`` may parse year-only datetime-string incorrectly using today's date, otherwise ``DatetimeIndex`` uses the beginning of the year.
40
+
``Timestamp`` and ``to_datetime`` may raise ``ValueError`` in some types of datetime-string which ``DatetimeIndex`` can parse, such as quarterly string.
41
+
42
+
Previous Behavior
43
+
44
+
.. code-block:: python
45
+
46
+
In [1]: Timestamp('2012Q2')
47
+
Traceback
48
+
...
49
+
ValueError: Unable to parse 2012Q2
50
+
51
+
# Results in today's date.
52
+
In [2]: Timestamp('2014')
53
+
Out [2]: 2014-08-12 00:00:00
54
+
55
+
v0.17.0 can parse them as below. It works on ``DatetimeIndex`` also.
56
+
57
+
New Behaviour
58
+
59
+
.. ipython:: python
60
+
61
+
Timestamp('2012Q2')
62
+
Timestamp('2014')
63
+
DatetimeIndex(['2012Q2', '2014'])
64
+
65
+
.. note:: If you want to perform calculations based on today's date, use ``Timestamp.now()`` and ``pandas.tseries.offsets``.
66
+
67
+
.. ipython:: python
68
+
69
+
import pandas.tseries.offsets as offsets
70
+
Timestamp.now()
71
+
Timestamp.now() + offsets.DateOffset(years=1)
72
+
73
+
- ``to_datetime`` can now accept ``yearfirst`` keyword (:issue:`7599`)
74
+
36
75
- ``.as_blocks`` will now take a ``copy`` optional argument to return a copy of the data, default is to copy (no change in behavior from prior versions), (:issue:`9607`)
37
76
38
77
- ``regex`` argument to ``DataFrame.filter`` now handles numeric column names instead of raising ``ValueError`` (:issue:`10384`).
0 commit comments