You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so you may find that I can't make a minimal excel file to let you reproduce the DataError. On the other hand, my original df is made by concating some privacy excel files, which I can't share too.
Can anyone give me some hints? Thanks
df = pd.concat(
[pd.read_excel(i, convertor={'ID2': int, 'pin': int}) for i in someXlsFilenames]
)
df.head(1)
_
time
ID1
ID2
goods
pin
owener
price
weight
from
to
material
source
152
2013-2014_1
BS080003123
1311225
Data Transfomers
1200830216
Jack Chan
65
1.0
England
USA
wood
13-14-1.xls
The text was updated successfully, but these errors were encountered:
Hi, @retsyo could you please make up a df that could reproduce the issue? (understand that it is a private excel file you cannot share, but you could read it into a df and change column names and values etc)
This is due to the way GroupBy objects handle the different aggregation methods. In fact sum and mean are handled differently. GroupBy.mean function call dispatches to self._cython_agg_general which checks for numeric types and in case it doesn't find any (which is the case for your example) it raises a DataError. Though the call to self._cython_agg_general is wrapped in try/except in case of a GroupByError it just re-raises and DataError inherits from GroupByError. Thus the exception.
By applying pd.to_numeric you convert them to numeric type and the agg works.
I am using pandas 1.0.3 in anaconda python 3.6.6 64 bits on win7 64 bits
the following code
says something like #17382
but if I do
then I get the pivot table as I expected
the question
so you may find that I can't make a minimal excel file to let you reproduce the
DataError
. On the other hand, my originaldf
is made byconcat
ing some privacy excel files, which I can't share too.Can anyone give me some hints? Thanks
The text was updated successfully, but these errors were encountered: