We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This errors for me on master as well: http://stackoverflow.com/questions/29945342/pandas-error-with-pivot-table-and-categorical-data
category1 category2 numeric 0 grey complete 1 1 grey complete 2 2 NaN incomplete 3 3 blue complete 4
In [13]: df = pd.read_clipboard() # with plain strings it works In [16]: pd.pivot_table(df, index = 'category1', columns = 'category2', values = 'numeric', aggfunc = 'count') Out[16]: category2 complete category1 blue 1 grey 2 In [17]: df['category1'] = df['category1'].astype('category') In [18]: df['category2'] = df['category2'].astype('category') In [19]: pd.pivot_table(df, index = 'category1', columns = 'category2', values = 'numeric', aggfunc = 'count') --------------------------------------------------------------------------- ValueError Traceback (most recent call last) ... c:\users\vdbosscj\scipy\pandas-joris\pandas\core\common.py in _astype_nansafe(ar r, dtype, copy) 2726 2727 if np.isnan(arr).any(): -> 2728 raise ValueError('Cannot convert NA to integer') 2729 elif arr.dtype == np.object_ and np.issubdtype(dtype.type, np.intege r): 2730 # work around NumPy brokenness, #1987 ValueError: Cannot convert NA to integer
The text was updated successfully, but these errors were encountered:
dupe of #9534
Sorry, something went wrong.
No branches or pull requests
This errors for me on master as well: http://stackoverflow.com/questions/29945342/pandas-error-with-pivot-table-and-categorical-data
The text was updated successfully, but these errors were encountered: