forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5dedfba
commit 277a81a
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# BUG: TypeError: Int64 when using pd.pivot_table with Int64 values #47477 | ||
|
||
import pandas as pd | ||
import io | ||
|
||
print(pd.__version__) | ||
|
||
|
||
data = """,country_live,employment_status,age | ||
26983,United States,Fully employed by a company / organization,21 | ||
51776,Turkey,Working student,18 | ||
53092,India,Fully employed by a company / organization,21 | ||
44612,France,Fully employed by a company / organization,21 | ||
7043,United States,"Self-employed (a person earning income directly from one's own business, trade, or profession)",60 | ||
50421,Other country,Fully employed by a company / organization,21 | ||
2552,United Kingdom,Fully employed by a company / organization,30 | ||
21166,China,Fully employed by a company / organization,21 | ||
29144,Italy,Fully employed by a company / organization,40 | ||
36828,United States,Fully employed by a company / organization,40""" | ||
|
||
df = pd.read_csv(io.StringIO(data)) | ||
( | ||
df.astype({"age": "Int64"}).pivot_table( | ||
index="country_live", columns="employment_status", values="age", aggfunc="mean" | ||
) | ||
) | ||
|
||
print(df) |