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
@@ -35,6 +35,45 @@ Other enhancements
35
35
^^^^^^^^^^^^^^^^^^
36
36
- Enable `read_hdf` to be used without specifying a key when the HDF file contains a single dataset (:issue:`10443`)
37
37
38
+
- ``DatetimeIndex`` can be instantiated using strings contains ``NaT`` (:issue:`7599`)
39
+
- The string parsing of ``to_datetime``, ``Timestamp`` and ``DatetimeIndex`` has been made consistent" (:issue:`7599`)
40
+
41
+
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.
42
+
``Timestamp`` and ``to_datetime`` may raise ``ValueError`` in some types of datetime-string which ``DatetimeIndex`` can parse, such as quarterly string.
43
+
44
+
Previous Behavior
45
+
46
+
.. code-block:: python
47
+
48
+
In [1]: Timestamp('2012Q2')
49
+
Traceback
50
+
...
51
+
ValueError: Unable to parse 2012Q2
52
+
53
+
# Results in today's date.
54
+
In [2]: Timestamp('2014')
55
+
Out [2]: 2014-08-12 00:00:00
56
+
57
+
v0.17.0 can parse them as below. It works on ``DatetimeIndex`` also.
58
+
59
+
New Behaviour
60
+
61
+
.. ipython:: python
62
+
63
+
Timestamp('2012Q2')
64
+
Timestamp('2014')
65
+
DatetimeIndex(['2012Q2', '2014'])
66
+
67
+
.. note:: If you want to perform calculations based on today's date, use ``Timestamp.now()`` and ``pandas.tseries.offsets``.
68
+
69
+
.. ipython:: python
70
+
71
+
import pandas.tseries.offsets as offsets
72
+
Timestamp.now()
73
+
Timestamp.now() + offsets.DateOffset(years=1)
74
+
75
+
- ``to_datetime`` can now accept ``yearfirst`` keyword (:issue:`7599`)
76
+
38
77
- ``.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`)
39
78
40
79
- ``regex`` argument to ``DataFrame.filter`` now handles numeric column names instead of raising ``ValueError`` (:issue:`10384`).
0 commit comments