Commit 6b9a3ffe authored by 舒皓月's avatar 舒皓月

20191220_1

parent 38f9b4c7
......@@ -22,6 +22,7 @@ plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False
plt.rcParams['savefig.dpi'] = 150
class AUCMonitor:
'''
定时间段查看AUC.
......@@ -259,6 +260,7 @@ class AUCMonitor:
return '-'.join(data)
except:
return '全渠道'
for user_group_name in info_dict:
tmp_dict = {'model_name': [self.field_query_name_dict[field]],
'app_type': [app_type(user_group_name)],
......@@ -288,10 +290,10 @@ class AUCMonitor:
# 获取MongoDB数据.
if self.if_read:
condition = {'wf_created_at': {'$gte': '%s 00:00:00' % self.date_list[0],
'$lte': '%s 00:00:00' % self.date_list[-1]},
condition = {'lam_loan_start_date': {'$gte': '%s 00:00:00' % self.date_list[0],
'$lte': '%s 00:00:00' % self.date_list[-1]},
'passdue_day': {'$ne': None}}
fields = {'wf_biz_no': 1, 'wf_created_at': 1, 'wf_loan_type': 1,
fields = {'wf_biz_no': 1, 'lam_loan_start_date': 1, 'wf_loan_type': 1,
'passdue_day': 1, 'wf_biz_channel': 1, 'applied_channel_cn': 1,
'lam_transaction_status': 1,
'repayment_status': 1,
......@@ -305,12 +307,12 @@ class AUCMonitor:
self.mongo_df = pd.read_csv(self.save_path + 'data/mongo_data.csv')
self.mongo_df['applied_type'] = self.mongo_df['wf_loan_type'].apply(func_0)
self.mongo_df['applied_at'] = self.mongo_df['wf_created_at']
self.mongo_df['applied_at'] = self.mongo_df['lam_loan_start_date']
self.mongo_df['applied_from'] = self.mongo_df['wf_biz_channel']
self.mongo_df['applied_channel'] = self.mongo_df['applied_channel_cn']
del self.mongo_df['wf_loan_type']
del self.mongo_df['wf_created_at']
del self.mongo_df['lam_loan_start_date']
del self.mongo_df['wf_biz_channel']
del self.mongo_df['applied_channel_cn']
......@@ -319,7 +321,8 @@ class AUCMonitor:
self.mongo_df = self.mongo_df.loc[self.mongo_df['applied_type'].notna()]
last_day = datetime.datetime.today()
self.mongo_df['deadline'] = self.mongo_df['deadline'].apply(lambda x: pd.datetime.strptime(x, '%Y-%m-%d %H:%M:%S'))
self.mongo_df['deadline'] = self.mongo_df['deadline'].apply(
lambda x: pd.datetime.strptime(x, '%Y-%m-%d %H:%M:%S'))
self.mongo_df['is_behave'] = self.mongo_df['deadline'].apply(lambda x: int((last_day - x).days > 15))
self.mongo_df = self.mongo_df.loc[self.mongo_df['is_behave'] == 1]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment