Skip to content

Commit b44ca16

Browse files
anhqlesweb
authored andcommitted
rebase onto upstream master
1 parent a69438f commit b44ca16

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

pandas/core/reshape/pivot.py

-7
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,6 @@ def pivot_table(data, values=None, index=None, columns=None, aggfunc='mean',
8181
pass
8282
values = list(values)
8383

84-
num_rows = (data.reindex(columns=index).drop_duplicates().shape[0]
85-
if index else 1)
86-
num_cols = (data.reindex(columns=columns).drop_duplicates().shape[0]
87-
if columns else 1)
88-
if num_rows * num_cols * len(values) > (2 ** 31 - 1):
89-
raise ValueError('Pivot table is too big, causing int32 overflow')
90-
9184
grouped = data.groupby(keys)
9285
agged = grouped.agg(aggfunc)
9386
if dropna and isinstance(agged, ABCDataFrame) and len(agged.columns):

pandas/tests/reshape/test_pivot.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1280,11 +1280,11 @@ def test_pivot_string_func_vs_func(self, f, f_numpy):
12801280
def test_pivot_number_of_levels_larger_than_int32(self):
12811281
# GH 20601
12821282
df = DataFrame({'ind1': np.arange(2 ** 16),
1283-
'ind2': np.arange(2 ** 16),
1284-
'count': np.arange(2 ** 16)})
1283+
'ind2': np.arange(2 ** 16),
1284+
'count': np.arange(2 ** 16)})
12851285
with tm.assert_raises_regex(ValueError, 'int32 overflow'):
12861286
df.pivot_table(index='ind1', columns='ind2',
1287-
values='count', aggfunc='count')
1287+
values='count', aggfunc='count')
12881288

12891289

12901290
class TestCrosstab(object):

0 commit comments

Comments
 (0)