Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
whatsnew
  • Loading branch information
rhshadrach committed May 8, 2021
commit b6de44a4ee3b4d4f2c87ab4df3c89fdac76d4e86
25 changes: 25 additions & 0 deletions doc/source/whatsnew/v1.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,31 @@ values as measured by ``np.allclose``. Now no such casting occurs.

df.groupby('key').agg(lambda x: x.sum())

``float`` result for :meth:`.GroupBy.mean`, :meth:`.GroupBy.median`, and :meth:`.GroupBy.var`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Previously, these methods could result in different dtypes depending on the input values.
Now, these methods will always return a float dtype. (:issue:`41137`)

.. ipython:: python

df = pd.DataFrame({'a': [True], 'b': [1], 'c': [1.0]})

*pandas 1.2.x*

.. code-block:: ipython

In [5]: df.groupby(df.index).mean()
Out[5]:
a b c
0 True 1 1.0

*pandas 1.3.0*

.. ipython:: python

df.groupby(df.index).mean()

Try operating inplace when setting values with ``loc`` and ``iloc``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down