I am working with a test dataset of the Lending Club loan data and am trying to create some analysis with the set.
After loading the csv into a dataframe, I am just trying to do a simple sum on the entire funded_amnt column. I keep receiving a negative amount for the sum even though there are no negative numbers in the entire set. How can this be?
In[ ]: loans_df['funded_amnt'].sum()
Out[ ]: -1925852142
In[ ]: len(loans_df[loans_df['funded_amnt']<0])
Out[ ]: 0
This could be an overflow problem. But it's hard to tell without a [mcve]...
Example:
pd.DataFrame([2**61]*2).sum()
Out[345]:
0 4611686018427387904
dtype: int64
pd.DataFrame([2**61]*3).sum()
Out[346]:
0 6917529027641081856
dtype: int64
pd.DataFrame([2**61]*4).sum()
Out[347]:
0 -9223372036854775808
dtype: int64
pd.DataFrame([2**61]*5).sum()
Out[348]:
0 -6917529027641081856
dtype: int64
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.