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
Previously, columns that were categorical, but not the groupby key(s) would be converted to ``object`` dtype during groupby operations. Pandas now will preserve these dtypes. (:issue:`18502`)
406
406
@@ -740,6 +740,47 @@ consistent with NumPy and the rest of pandas (:issue:`21801`).
740
740
cat.argsort()
741
741
cat[cat.argsort()]
742
742
743
+
.. _whatsnew_0250.api_breaking.list_of_dict:
744
+
745
+
Column order is preserved when passing a list of dicts to DataFrame
Starting with Python 3.7 the key-order of ``dict``is`guaranteed <https://mail.python.org/pipermail/python-dev/2017-December/151283.html>`_. In practice, this has been true since
749
+
Python 3.6. The :class:`DataFrame` constructor now treats a list of dicts in the same way as
750
+
it does a list of ``OrderedDict``, i.e. preserving the order of the dicts.
751
+
This change applies only when pandas is running on Python>=3.6 (:issue:`27309`).
The columns were lexicographically sorted previously,
764
+
765
+
.. code-block:: python
766
+
767
+
In [1]: pd.DataFrame(data)
768
+
Out[1]:
769
+
age finances hobby name state
770
+
018 NaN NaN Joe NY
771
+
119 NaN Minecraft Jane KY
772
+
220 good NaN Jean OK
773
+
774
+
*New Behavior*:
775
+
776
+
The column order now matches the insertion-order of the keys in the ``dict``,
777
+
considering all the records from top to bottom. As a consequence, the column
778
+
order of the resulting DataFrame has changed compared to previous pandas verisons.
779
+
780
+
.. ipython:: python
781
+
782
+
pd.DataFrame(data)
783
+
743
784
.. _whatsnew_0250.api_breaking.deps:
744
785
745
786
Increased minimum versions for dependencies
@@ -939,6 +980,7 @@ Performance improvements
939
980
- Improved performance by removing the need for a garbage collect when checking for``SettingWithCopyWarning`` (:issue:`27031`)
940
981
- For :meth:`to_datetime` changed default value of cache parameter to ``True`` (:issue:`26043`)
941
982
- Improved performance of :class:`DatetimeIndex`and :class:`PeriodIndex` slicing given non-unique, monotonic data (:issue:`27136`).
983
+
- Improved performance of :meth:`pd.read_json`for index-oriented data. (:issue:`26773`)
942
984
943
985
.. _whatsnew_0250.bug_fixes:
944
986
@@ -995,6 +1037,7 @@ Timezones
995
1037
- Bug in :func:`DataFrame.join` where joining a timezone aware index with a timezone aware column would result in a column of ``NaN`` (:issue:`26335`)
996
1038
- Bug in :func:`date_range` where ambiguous or nonexistent start or end times were not handled by the ``ambiguous``or``nonexistent`` keywords respectively (:issue:`27088`)
997
1039
- Bug in :meth:`DatetimeIndex.union` when combining a timezone aware and timezone unaware :class:`DatetimeIndex` (:issue:`21671`)
1040
+
- Bug when applying a numpy reduction function (e.g. :meth:`numpy.minimum`) to a timezone aware :class:`Series` (:issue:`15552`)
998
1041
999
1042
Numeric
1000
1043
^^^^^^^
@@ -1054,7 +1097,8 @@ Indexing
1054
1097
- Bug in :class:`CategoricalIndex`and :class:`Categorical` incorrectly raising ``ValueError`` instead of ``TypeError`` when a listis passed using the ``in`` operator (``__contains__``) (:issue:`21729`)
1055
1098
- Bug in setting a new value in a :class:`Series`with a :class:`Timedelta`object incorrectly casting the value to an integer (:issue:`22717`)
1056
1099
- Bug in :class:`Series` setting a new key (``__setitem__``) with a timezone-aware datetime incorrectly raising ``ValueError`` (:issue:`12862`)
1057
-
-
1100
+
- Bug in :meth:`DataFrame.iloc` when indexing with a read-only indexer (:issue:`17192`)
1101
+
- Bug in :class:`Series` setting an existing tuple key (``__setitem__``) with timezone-aware datetime values incorrectly raising ``TypeError`` (:issue:`20441`)
1058
1102
1059
1103
Missing
1060
1104
^^^^^^^
@@ -1086,7 +1130,6 @@ I/O
1086
1130
- Bug in :meth:`DataFrame.to_html` where header numbers would ignore display options when rounding (:issue:`17280`)
1087
1131
- Bug in :func:`read_hdf` where reading a table from an HDF5file written directly with PyTables fails with a ``ValueError`` when using a sub-selection via the ``start``or``stop`` arguments (:issue:`11188`)
1088
1132
- Bug in :func:`read_hdf`not properly closing store after a ``KeyError``is raised (:issue:`25766`)
1089
-
- Bug in``read_csv`` which would notraise``ValueError``if a column index in``usecols`` was out of bounds (:issue:`25623`)
1090
1133
- Improved the explanation for the failure when value labels are repeated in Stata dta files and suggested work-arounds (:issue:`25772`)
1091
1134
- Improved :meth:`pandas.read_stata`and :class:`pandas.io.stata.StataReader` to read incorrectly formatted 118format files saved by Stata (:issue:`25960`)
1092
1135
- Improved the ``col_space`` parameter in :meth:`DataFrame.to_html` to accept a string so CSS length values can be set correctly (:issue:`25941`)
@@ -1103,6 +1146,7 @@ I/O
1103
1146
- Bug in :meth:`read_hdf` where reading a timezone aware :class:`DatetimeIndex` would raise a ``TypeError`` (:issue:`11926`)
1104
1147
- Bug in :meth:`to_msgpack`and :meth:`read_msgpack` which would raise a ``ValueError`` rather than a ``FileNotFoundError``for an invalid path (:issue:`27160`)
1105
1148
- Fixed bug in :meth:`DataFrame.to_parquet` which would raise a ``ValueError`` when the dataframe had no columns (:issue:`27339`)
1149
+
- Allow parsing of :class:`PeriodDtype` columns when using :func:`read_csv` (:issue:`26934`)
1106
1150
1107
1151
Plotting
1108
1152
^^^^^^^^
@@ -1111,7 +1155,7 @@ Plotting
1111
1155
- Bug in an error message in :meth:`DataFrame.plot`. Improved the error message if non-numerics are passed to :meth:`DataFrame.plot` (:issue:`25481`)
1112
1156
- Bug in incorrect ticklabel positions when plotting an index that are non-numeric / non-datetime (:issue:`7612`, :issue:`15912`, :issue:`22334`)
1113
1157
- Fixed bug causing plots of :class:`PeriodIndex` timeseries to fail if the frequency is a multiple of the frequency rule code (:issue:`14763`)
1114
-
-
1158
+
- Fixed bug when plotting a :class:`DatetimeIndex`with``datetime.timezone.utc`` timezone (:issue:`17173`)
0 commit comments