Python Pandas:尝试bin数据时遇到错误

时间:2017-01-11 16:43:36

标签: python pandas dataframe bin

Python正在返回此错误消息。有人会碰巧知道如何修理吗?

 TypeError: putmask() argument 1 must be numpy.ndarray, not numpy.int64

我在尝试使用pd.cut将数据分类到不同的bin时出现此错误,如下所示:

df['Credit Score'].fillna(0, inplace=True)
df['Credit Score'] = df['Credit Score'].astype(int)
bins = [0, 500, 550, 600, 650]
Summary_Scores = df.groupby(pd.cut('Credit Score', bins))

正在从csv文件中读取数据:

<class 'pandas.core.frame.DataFrame'>
Int64Index: 5729 entries, 0 to 252032
Data columns (total 5 columns):
Loan #          5729 non-null int64
Amount          5729 non-null float64
Issue Date      5729 non-null datetime64[ns]
Purposes        5661 non-null object
Credit Score    5729 non-null int32
dtypes: datetime64[ns](1), float64(1), int32(1), int64(1), object(1)
memory usage: 246.2+ KB
None

0 个答案:

没有答案