Skip to content

Commit db1652f

Browse files
committed
Revert unnecessary changes from 22019
At the time, pandas-dev#22019 seemed to break API in a few places. Since then, those API breaking changes have disappeared, so the changes to the tests and the release note are no longer necessary. Closes pandas-dev#24789
1 parent 5a15a37 commit db1652f

File tree

3 files changed

+4
-35
lines changed

3 files changed

+4
-35
lines changed

doc/source/whatsnew/v0.24.0.rst

-30
Original file line numberDiff line numberDiff line change
@@ -1163,36 +1163,6 @@ data is incompatible with a passed ``dtype=`` (:issue:`15832`)
11631163
...
11641164
OverflowError: Trying to coerce negative values to unsigned integers
11651165
1166-
.. _whatsnew_0240.api.crosstab_dtypes:
1167-
1168-
Crosstab Preserves Dtypes
1169-
^^^^^^^^^^^^^^^^^^^^^^^^^
1170-
1171-
:func:`crosstab` will preserve now dtypes in some cases that previously would
1172-
cast from integer dtype to floating dtype (:issue:`22019`)
1173-
1174-
*Previous Behavior*:
1175-
1176-
.. code-block:: ipython
1177-
1178-
In [3]: df = pd.DataFrame({'a': [1, 2, 2, 2, 2], 'b': [3, 3, 4, 4, 4],
1179-
...: 'c': [1, 1, np.nan, 1, 1]})
1180-
In [4]: pd.crosstab(df.a, df.b, normalize='columns')
1181-
Out[4]:
1182-
b 3 4
1183-
a
1184-
1 0.5 0.0
1185-
2 0.5 1.0
1186-
1187-
*New Behavior*:
1188-
1189-
.. code-block:: ipython
1190-
1191-
In [3]: df = pd.DataFrame({'a': [1, 2, 2, 2, 2],
1192-
...: 'b': [3, 3, 4, 4, 4],
1193-
...: 'c': [1, 1, np.nan, 1, 1]})
1194-
In [4]: pd.crosstab(df.a, df.b, normalize='columns')
1195-
11961166
.. _whatsnew_0240.api.concat_categorical:
11971167

11981168
Concatenation Changes

pandas/tests/frame/test_axis_select_reindex.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def test_align_int_fill_bug(self):
717717

718718
result = df1 - df1.mean()
719719
expected = df2 - df2.mean()
720-
assert_frame_equal(result.astype('f8'), expected)
720+
assert_frame_equal(result, expected)
721721

722722
def test_align_multiindex(self):
723723
# GH 10665

pandas/tests/reshape/test_pivot.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1573,9 +1573,8 @@ def test_crosstab_normalize(self):
15731573
full_normal)
15741574
tm.assert_frame_equal(pd.crosstab(df.a, df.b, normalize='index'),
15751575
row_normal)
1576-
tm.assert_frame_equal(
1577-
pd.crosstab(df.a, df.b, normalize='columns').astype('f8'),
1578-
col_normal)
1576+
tm.assert_frame_equal(pd.crosstab(df.a, df.b, normalize='columns'),
1577+
col_normal)
15791578
tm.assert_frame_equal(pd.crosstab(df.a, df.b, normalize=1),
15801579
pd.crosstab(df.a, df.b, normalize='columns'))
15811580
tm.assert_frame_equal(pd.crosstab(df.a, df.b, normalize=0),
@@ -1608,7 +1607,7 @@ def test_crosstab_normalize(self):
16081607
tm.assert_frame_equal(pd.crosstab(df.a, df.b, normalize='index',
16091608
margins=True), row_normal_margins)
16101609
tm.assert_frame_equal(pd.crosstab(df.a, df.b, normalize='columns',
1611-
margins=True).astype('f8'),
1610+
margins=True),
16121611
col_normal_margins)
16131612
tm.assert_frame_equal(pd.crosstab(df.a, df.b, normalize=True,
16141613
margins=True), all_normal_margins)

0 commit comments

Comments
 (0)