Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
feature-api-test
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
feature-api-test
Commits
08a171c1
Commit
08a171c1
authored
Feb 03, 2020
by
路朝阳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加归属地特征2个进行提交
parent
cccf07af
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
208 additions
and
16 deletions
+208
-16
v7模型_延伸特征vcc.ipynb
J_feature/v7模型_延伸特征vcc.ipynb
+0
-0
feature_mapping.xlsx
data/feature_mapping.xlsx
+0
-0
Credit_process.py
features/calc_features/Credit_process.py
+34
-15
id_place_ownership.py
features/calc_features/id_place_ownership.py
+50
-0
测试报告_特征测试归属地编码查询特征.xlsx
report/测试报告_特征测试归属地编码查询特征.xlsx
+0
-0
特征测试-更新逻辑-在途申请单数量特征.xlsx
report/特征测试-更新逻辑-在途申请单数量特征.xlsx
+0
-0
Sql_cheat.py
service/Sql_cheat.py
+124
-1
No files found.
J_feature/v7模型_延伸特征vcc.ipynb
View file @
08a171c1
This source diff could not be displayed because it is too large. You can
view the blob
instead.
data/feature_mapping.xlsx
View file @
08a171c1
No preview for this file type
features/calc_features/Credit_process.py
View file @
08a171c1
...
...
@@ -43,21 +43,6 @@ class 填写中申请单数量():
class 在途申请单数量():
"""
apply_in_verify_num_v2
在途申请单数量(提交申请
->
完成放款)
"""
def feature(self):
_在途申请单数量 = -9999999
get_requisition_quantity_xyqb = requisition_quantity_xyqb(self.user_id,self._apply_at)
get_requisition_quantity_business_flow = requisition_quantity_business_flow(self.uuid,self._apply_at)
if get_requisition_quantity_xyqb.empty == False:
get_quantity_count = get_requisition_quantity_xyqb['count_xyqb'].values[0]
if get_requisition_quantity_business_flow.empty == False:
get_business_flow_count = get_requisition_quantity_business_flow['count_business'].values[0]
_在途申请单数量 = get_quantity_count + get_business_flow_count
self._result['在途申请单数量']['value'] = _在途申请单数量
return self._result
class 用户申请订单在审核中的数量():
"""
new_xyqb_apply_in_credit_v2
用户申请订单在审核中的数量
"""
def feature(self):
...
...
@@ -68,3 +53,37 @@ class 用户申请订单在审核中的数量():
_用户申请订单在审核中的数量 = get_user_order_count
self._result['用户申请订单在审核中的数量']['value'] = _用户申请订单在审核中的数量
return self._result
# class 在途申请单数量():
#这个是老的特征 下面的特征进行了更改
# """
apply_in_verify_num_v2
在途申请单数量(提交申请
->
完成放款)
"""
# def feature(self):
# _在途申请单数量 = -9999999
# get_requisition_quantity_xyqb = requisition_quantity_xyqb(self.user_id,self._apply_at)
# get_requisition_quantity_business_flow = requisition_quantity_business_flow(self.uuid,self._apply_at)
# if get_requisition_quantity_xyqb.empty == False:
# get_quantity_count = get_requisition_quantity_xyqb['count_xyqb'].values[0]
# if get_requisition_quantity_business_flow.empty == False:
# get_business_flow_count = get_requisition_quantity_business_flow['count_business'].values[0]
# _在途申请单数量 = get_quantity_count + get_business_flow_count
# self._result['在途申请单数量']['value'] = _在途申请单数量
# return self._result
class 在途申请单数量():
"""
apply_in_verify_num_v2
在途申请单数量(提交申请
->
完成放款)
"""
def feature(self):
_在途申请单数量 = -9999999
get_requisition_quantity_xyqb = requisition_quantity_xyqb_new(self.user_id,self._apply_at)
get_requisition_quantity_business_flow = requisition_quantity_business_flow_new(self.uuid,self._apply_at)
if get_requisition_quantity_xyqb.empty == False:
get_quantity_count = get_requisition_quantity_xyqb['count_xyqb'].values[0]
if get_requisition_quantity_business_flow.empty == False:
get_business_flow_count = get_requisition_quantity_business_flow['count_business'].values[0]
_在途申请单数量 = get_quantity_count + get_business_flow_count
self._result['在途申请单数量']['value'] = _在途申请单数量
return self._result
\ No newline at end of file
features/calc_features/id_place_ownership.py
0 → 100644
View file @
08a171c1
# -*- coding:utf-8 -*-
from
features.Base_Features
import
BaseFeatures
as
BF
from
service.addresss_book_sql
import
*
import
datetime
from
service.Sql_cheat
import
*
from
service.Sql_contactsOperator
import
*
import
re
class
__INIT__
(
BF
):
def
__init__
(
self
):
time_now
=
datetime
.
datetime
.
strptime
(
datetime
.
datetime
.
strftime
(
datetime
.
datetime
.
now
(),
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
BF
.
_apply_at
=
time_now
if
self
.
orderId
:
_df
=
getSql_Apply_quota_record
(
self
.
user_id
,
self
.
orderId
)
if
_df
.
empty
==
False
:
BF
.
_apply_at
=
datetime
.
datetime
.
strptime
(
_df
[
'apply_time'
]
.
astype
(
str
)
.
values
[
0
],
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
)
class
根据手机号查找归属地编号():
""" 根据手机号查找归属地编号
lkb_user_phone_province_code
"""
def feature(self):
_根据手机号查找归属地编号 = 125
user_phone = getSql_userPhone(str(tuple([str(self.user_id)])).replace(',)',')'))['phone_no'].tolist()
"""
紧急联系人
"""
phone_info_city =get_phone_info(user_phone[0])[1]
if phone_info_city:
get_city_dict_df = city_dict_df()
"""
根据对应的列找到对应的值
"""
if phone_info_city == '内蒙古':
phone_info_city = '内蒙'
get_city_dict_value = get_city_dict_df[phone_info_city].values[0]
_根据手机号查找归属地编号 = get_city_dict_value
self._result['根据手机号查找归属地编号']['value'] = _根据手机号查找归属地编号
return self._result
class 根据身份证号查找归属地编号():
"""
根据身份证号查找归属地编号
user_province_code
"""
def feature(self):
_根据身份证号查找归属地编号 = -9999999
id_no_ = getSql_id_no(str(self.user_id))["id_no"].values[0]
if id_no_:
id_no_split_2 = str(id_no_)[0:2]
_根据身份证号查找归属地编号 = int(id_no_split_2)
self._result['根据身份证号查找归属地编号']['value'] = _根据身份证号查找归属地编号
return self._result
\ No newline at end of file
report/测试报告_特征测试归属地编码查询特征.xlsx
0 → 100644
View file @
08a171c1
File added
report/特征测试-更新逻辑-在途申请单数量特征.xlsx
0 → 100644
View file @
08a171c1
File added
service/Sql_cheat.py
View file @
08a171c1
...
...
@@ -111,4 +111,127 @@ def user_order_approval(uuid,apply_time):
Sql
=
"""select count(id) count from apply_list where enable = 1
and apply_status =3 and uuid ='{0}' and created_at< '{1}'; """
.
format
(
uuid
,
apply_time
)
_df
=
pd
.
read_sql
(
Sql
,
con
=
con_business_flow
)
return
_df
\ No newline at end of file
return
_df
def
requisition_quantity_xyqb_new
(
userid
,
apply_time
):
"""xyqb 在在途申请单数量"""
Sql
=
"""SELECT count(*) count_xyqb FROM assign_funding_record a
left join assets_order b on a.asset_order_id=b.id
left join waiting_funding_corp_operate_people c on b.loan_id=c.loan_application_history_id
WHERE a.assign_status=3 and (c.id is null or c.funding_corp_progress not in (5,6))
and a.user_id='{0}' and a.created_at<'{1}';"""
.
format
(
userid
,
apply_time
)
_df
=
pd
.
read_sql
(
Sql
,
con
=
con_tuomin_xyqb
)
return
_df
def
requisition_quantity_business_flow_new
(
uuid
,
apply_time
):
"""business_flow 在在途申请单数量"""
Sql
=
"""SELECT count(*) count_business FROM apply_list
WHERE (apply_status in (2,3) or (apply_status =4 and audit_result<>0)) and (assets_result<>2 or assets_result is null)
and uuid ='{0}' and created_at< '{1}';"""
.
format
(
uuid
,
apply_time
)
_df
=
pd
.
read_sql
(
Sql
,
con
=
con_business_flow
)
return
_df
from
phone
import
Phone
def
get_phone_info
(
phone_num
):
"""根据手机号查询省份"""
phone_info
=
Phone
()
.
find
(
phone_num
)
try
:
phone
=
phone_info
[
'phone'
]
province
=
phone_info
[
'province'
]
# 省
city
=
phone_info
[
'city'
]
# 城市
zip_code
=
phone_info
[
'zip_code'
]
# 邮编
area_code
=
phone_info
[
'area_code'
]
# 区号
phone_type
=
phone_info
[
'phone_type'
]
# 运营商
except
:
print
(
'----- the phone number is empty, please check your phone number! -----'
)
return
phone
,
province
,
city
,
zip_code
,
area_code
,
phone_type
def
city_dict_df
():
"""标准的归属地码表"""
city_dict
=
{
'北京'
:
11
,
'天津'
:
12
,
'河北'
:
13
,
'山西'
:
14
,
'内蒙'
:
15
,
'辽宁'
:
21
,
'吉林'
:
22
,
'黑龙江'
:
23
,
'上海'
:
31
,
'江苏'
:
32
,
'浙江'
:
33
,
'安徽'
:
34
,
'福建'
:
35
,
'江西'
:
36
,
'山东'
:
37
,
'河南'
:
41
,
'湖北'
:
42
,
'湖南'
:
43
,
'广东'
:
44
,
'广西'
:
45
,
'海南'
:
46
,
'重庆'
:
50
,
'四川'
:
51
,
'贵州'
:
52
,
'云南'
:
53
,
'西藏'
:
54
,
'陕西'
:
61
,
'甘肃'
:
62
,
'青海'
:
63
,
'宁夏'
:
64
,
'新疆'
:
65
,
'台湾'
:
71
,
'香港'
:
81
,
'澳门'
:
82
,
'海外'
:
91
}
df
=
pd
.
DataFrame
(
city_dict
,
pd
.
Index
(
range
(
1
)))
return
df
def
idcard_dict_df
():
"""标准的身份证归属地码表"""
idcard_dict
=
{
'北京'
:
11
,
'天津'
:
12
,
'河北'
:
13
,
'山西'
:
14
,
'内蒙'
:
15
,
'辽宁'
:
21
,
'吉林'
:
22
,
'黑龙江'
:
23
,
'上海'
:
31
,
'江苏'
:
32
,
'浙江'
:
33
,
'安徽'
:
34
,
'福建'
:
35
,
'江西'
:
36
,
'山东'
:
37
,
'河南'
:
41
,
'湖北'
:
42
,
'湖南'
:
43
,
'广东'
:
44
,
'广西'
:
45
,
'海南'
:
46
,
'重庆'
:
50
,
'四川'
:
51
,
'贵州'
:
52
,
'云南'
:
53
,
'西藏'
:
54
,
'陕西'
:
61
,
'甘肃'
:
62
,
'青海'
:
63
,
'宁夏'
:
64
,
'新疆'
:
65
,
'台湾'
:
71
,
'香港'
:
81
,
'澳门'
:
82
,
'海外'
:
91
}
df
=
pd
.
DataFrame
(
idcard_dict
,
pd
.
Index
(
range
(
1
)))
return
df
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment