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.19.0.txt
+31-2
Original file line number
Diff line number
Diff line change
@@ -457,7 +457,7 @@ API changes
457
457
- ``Timestamp``, ``Period``, ``DatetimeIndex``, ``PeriodIndex`` and ``.dt`` accessor have gained a ``.is_leap_year`` property to check whether the date belongs to a leap year. (:issue:`13727`)
458
458
- ``pd.read_hdf`` will now raise a ``ValueError`` instead of ``KeyError``, if a mode other than ``r``, ``r+`` and ``a`` is supplied. (:issue:`13623`)
459
459
- ``DataFrame.values`` will now return ``float64`` with a ``DataFrame`` of mixed ``int64`` and ``uint64`` dtypes, conforming to ``np.find_common_type`` (:issue:`10364`, :issue:`13917`)
460
-
460
+
- ``Series.unique()`` with datetime and timezone now returns return array of ``Timestamp`` with timezone (:issue:`13565`)
461
461
462
462
463
463
@@ -904,6 +904,35 @@ New Behavior:
904
904
idx1.difference(idx2)
905
905
idx1.symmetric_difference(idx2)
906
906
907
+
.. _whatsnew_0190.api.unique_index:
908
+
909
+
``Index.unique`` consistently returns ``Index``
910
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
911
+
912
+
``Index.unique()`` now returns unique values as an
913
+
``Index`` of the appropriate ``dtype``. (:issue:`13395`)
914
+
915
+
Previously, most ``Index`` classes returned ``np.ndarray``, and ``DatetimeIndex``,
916
+
``TimedeltaIndex`` and ``PeriodIndex`` returned ``Index`` to keep metadata like timezone.
917
+
918
+
Previous Behavior:
919
+
920
+
.. code-block:: ipython
921
+
922
+
In [1]: pd.Index([1, 2, 3]).unique()
923
+
Out[1]: array([1, 2, 3])
924
+
In [2]: pd.DatetimeIndex(['2011-01-01', '2011-01-02', '2011-01-03'], tz='Asia/Tokyo').unique()
- Bug in ``pd.read_csv``, ``pd.read_table``, ``pd.read_fwf``, ``pd.read_stata`` and ``pd.read_sas`` where files were opened by parsers but not closed if both ``chunksize`` and ``iterator`` were ``None``. (:issue:`13940`)
1182
1211
- Bug in ``StataReader``, ``StataWriter``, ``XportReader`` and ``SAS7BDATReader`` where a file was not properly closed when an error was raised. (:issue:`13940`)
1183
1212
1213
+
1184
1214
- Bug in ``pd.pivot_table()`` where ``margins_name`` is ignored when ``aggfunc`` is a list (:issue:`13354`)
1185
1215
- Bug in ``pd.Series.str.zfill``, ``center``, ``ljust``, ``rjust``, and ``pad`` when passing non-integers, did not raise ``TypeError`` (:issue:`13598`)
1186
1216
- Bug in checking for any null objects in a ``TimedeltaIndex``, which always returned ``True`` (:issue:`13603`)
@@ -1248,7 +1278,6 @@ Bug Fixes
1248
1278
1249
1279
- Bug in ``agg()`` function on groupby dataframe changes dtype of ``datetime64[ns]`` column to ``float64`` (:issue:`12821`)
1250
1280
- Bug in using NumPy ufunc with ``PeriodIndex`` to add or subtract integer raise ``IncompatibleFrequency``. Note that using standard operator like ``+`` or ``-`` is recommended, because standard operators use more efficient path (:issue:`13980`)
1251
-
1252
1281
- Bug in operations on ``NaT`` returning ``float`` instead of ``datetime64[ns]`` (:issue:`12941`)
1253
1282
- Bug in ``Series`` flexible arithmetic methods (like ``.add()``) raises ``ValueError`` when ``axis=None`` (:issue:`13894`)
0 commit comments