根据数据类型选择特征 select_dtypes(include=[]/exclude=[])

根据数据类型选择特征 select_dtypes(include=['']/exclude=[])

In [21]:
df.select_dtypes(include=['object']).columns.values
 
Out[21]:
array(['term', 'loan_status', 'int_rate', 'emp_length', 'home_ownership',
       'verification_status', 'desc', 'purpose', 'title', 'zip_code',
       'addr_state', 'issue_d', 'earliest_cr_line'], dtype=object)
In [22]:
 
df.select_dtypes(exclude=['object']).columns.values
 
Out[22]:
array(['member_id', 'loan_amnt', 'annual_inc', 'dti', 'delinq_2yrs',
       'inq_last_6mths', 'mths_since_last_delinq',
       'mths_since_last_record', 'open_acc', 'pub_rec', 'total_acc',
       'pub_rec_bankruptcies'], dtype=object)

posted on 2019-07-30 08:35  离云1  阅读(3001)  评论(0编辑  收藏  举报

导航