Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
duizhang_tools
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data—王林芳
duizhang_tools
Commits
52020acf
Commit
52020acf
authored
Nov 07, 2017
by
data—王林芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去哪儿在贷done
parent
163d69a0
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
27 deletions
+34
-27
去哪儿-在贷-汇总表.ipynb
审计第二阶段/去哪儿/在贷-林芳版本/去哪儿-在贷-汇总表.ipynb
+34
-27
去哪儿在贷-明细细分.ipynb
审计第二阶段/去哪儿/在贷-林芳版本/去哪儿在贷-明细细分.ipynb
+0
-0
No files found.
审计第二阶段/去哪儿/在贷-林芳版本/去哪儿-在贷-汇总表.ipynb
View file @
52020acf
...
...
@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 1
6
,
"metadata": {
"collapsed": true
},
...
...
@@ -24,20 +24,20 @@
},
{
"cell_type": "code",
"execution_count":
2
,
"execution_count":
17
,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"file_path = u'E:/量化派/去哪儿/
常规出账
/'\n",
"file_path = u'E:/量化派/去哪儿/
在贷
/'\n",
"file_name = u'在贷金额_%s_%s.xlsx'\n",
"engine_qunaer = create_engine('mysql+mysqldb://internal_r:ArbNgtvlJzZHXsEu@172.16.3.201:3306/qunaer_new?charset=utf8',echo=False)"
]
},
{
"cell_type": "code",
"execution_count":
3
,
"execution_count":
18
,
"metadata": {
"collapsed": true
},
...
...
@@ -52,18 +52,18 @@
},
{
"cell_type": "code",
"execution_count":
4
,
"execution_count":
null
,
"metadata": {
"collapsed":
tru
e
"collapsed":
fals
e
},
"outputs": [],
"source": [
"sql_pay='''\n",
"select product_no,stages,date(
trans_time) loan_time
from qunaer_new.pay_detail where fund_code =1\n",
"select product_no,stages,date(
loan_time) loan_time,loan_amount
from qunaer_new.pay_detail where fund_code =1\n",
"'''\n",
"df_pay=pd.read_sql(sql_pay,engine_qunaer)\n",
"sql_baoli_pay='''\n",
"select product_no,stages ,date(loan_time) loan_time from qunaer_new.baoli_pay_detail where fund_code = 1\n",
"select product_no,stages ,date(loan_time) loan_time
,loan_amount
from qunaer_new.baoli_pay_detail where fund_code = 1\n",
"'''\n",
"df_pay_baoli=pd.read_sql(sql_baoli_pay,engine_qunaer)\n",
"df_pay=pd.concat([df_pay,df_pay_baoli],ignore_index=True)"
...
...
@@ -71,7 +71,7 @@
},
{
"cell_type": "code",
"execution_count":
8
,
"execution_count":
19
,
"metadata": {
"collapsed": false
},
...
...
@@ -174,7 +174,7 @@
},
{
"cell_type": "code",
"execution_count":
9
,
"execution_count":
20
,
"metadata": {
"collapsed": true
},
...
...
@@ -185,7 +185,7 @@
},
{
"cell_type": "code",
"execution_count":
10
,
"execution_count":
21
,
"metadata": {
"collapsed": false
},
...
...
@@ -193,10 +193,10 @@
{
"data": {
"text/plain": [
"(6
3292349.239999957, 1136020154.9100001
)"
"(6
1429343.479999997, 1134149141.5299995
)"
]
},
"execution_count":
10
,
"execution_count":
21
,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -230,21 +230,21 @@
},
{
"cell_type": "code",
"execution_count": 2
70
,
"execution_count": 2
2
,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#====变量定义\n",
"user_plan_2016='repayment_plan_2016'\n",
"user_plan_2017='repayment_plan_2017'\n",
"listen_time = datetime.date(2017,
10,31
)"
"user_plan_2016='repayment_plan_2016
_201709
'\n",
"user_plan_2017='repayment_plan_2017
09
'\n",
"listen_time = datetime.date(2017,
9,30
)"
]
},
{
"cell_type": "code",
"execution_count": 2
71
,
"execution_count": 2
3
,
"metadata": {
"collapsed": true
},
...
...
@@ -258,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 2
72
,
"execution_count": 2
4
,
"metadata": {
"collapsed": true
},
...
...
@@ -274,7 +274,7 @@
},
{
"cell_type": "code",
"execution_count": 2
73
,
"execution_count": 2
5
,
"metadata": {
"collapsed": true
},
...
...
@@ -289,7 +289,7 @@
},
{
"cell_type": "code",
"execution_count": 2
74
,
"execution_count": 2
6
,
"metadata": {
"collapsed": false
},
...
...
@@ -306,7 +306,7 @@
},
{
"cell_type": "code",
"execution_count": 27
5
,
"execution_count": 27,
"metadata": {
"collapsed": false
},
...
...
@@ -314,10 +314,10 @@
{
"data": {
"text/plain": [
"
136249069.98999998
"
"
61429343.479999974
"
]
},
"execution_count": 27
5
,
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
...
...
@@ -416,9 +416,16 @@
"df_plan_tmp['no_pay']=df_plan_tmp[u'zaidai'] / df_plan_tmp['p_count']\n",
"df_plan_tmp.deadline=pd.to_datetime(df_plan_tmp.deadline).dt.date\n",
"df_plan_tmp['date_diff']=df_plan_tmp.deadline.apply(lambda x:(listen_time-x).days)\n",
"df_plan_tmp.ix[df_plan_tmp['date_diff'] < 0 ,'date_name'] =u'未到期'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] >= 0) & (df_plan_tmp['date_diff'] <= 30 ) ,'date_name'] = u'逾期30天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 30) ,'date_name'] = u'逾期30天上'\n",
"df_plan_tmp.ix[df_plan_tmp['date_diff'] <= 0 ,'date_name'] =u'未到期'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 0) & (df_plan_tmp['date_diff'] <= 30 ) ,'date_name'] = u'逾期1-30天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 30) & (df_plan_tmp['date_diff'] <= 60),'date_name'] = u'逾期31-60天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 60) & (df_plan_tmp['date_diff'] <= 90),'date_name'] = u'逾期61-90天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 90) & (df_plan_tmp['date_diff'] <= 120),'date_name'] = u'逾期91-120天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 90) & (df_plan_tmp['date_diff'] <= 120),'date_name'] = u'逾期91-120天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 120) & (df_plan_tmp['date_diff'] <= 150),'date_name'] = u'逾期121-150天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 150) & (df_plan_tmp['date_diff'] <= 180),'date_name'] = u'逾期151-180天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 180) & (df_plan_tmp['date_diff'] <= 360),'date_name'] = u'逾期181-360天'\n",
"df_plan_tmp.ix[(df_plan_tmp['date_diff'] > 360),'date_name'] = u'逾期361天上'\n",
"df_plan_tmp = pd.merge(df_plan_tmp,df_pay[['product_no','loan_time','stages']],on='product_no',how='left')\n",
"df_plan_tmp.deadline=pd.to_datetime(df_plan_tmp.deadline).dt.date\n",
"df_plan_tmp.drop_duplicates(['product_no','deadline'],inplace=True)\n",
...
...
审计第二阶段/去哪儿/在贷-林芳版本/去哪儿在贷-明细细分.ipynb
0 → 100644
View file @
52020acf
This diff is collapsed.
Click to expand it.
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