{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from sqlalchemy import create_engine\n",
    "# con = create_engine('mysql+pymysql://root:rootroot@172.21.20.14:3306/model_data_test?charset=utf8')\n",
    "import pymysql\n",
    "\n",
    "# 创建连接\n",
    "conn = pymysql.connect(host='172.21.20.14', port=3306, user='root', passwd='rootroot', db='model_data_test', use_unicode=True, charset=\"utf8\")\n",
    "# conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='root', db='model_data_test', use_unicode=True, charset=\"utf8\")\n",
    "cursor = conn.cursor()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_excel('/Users/zhangpengcheng/Desktop/tongdun_to_pengcheng.xlsx')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "def myInsert(newList):\n",
    "    '''\n",
    "    数据库插入\n",
    "    :param newList: 传入的列表数据\n",
    "    :return:\n",
    "    '''\n",
    "    try:\n",
    "        sql = \"insert into user_test(data_set_datail_id,model_name,batch_uuid,data_detail) values(%s,%s,%s,%s)\" # 要插入的数据\n",
    "        print(sql)\n",
    "        cursor.executemany(sql,newList) # 执行插入数据\n",
    "\n",
    "        conn.commit()\n",
    "        cursor.close()\n",
    "        conn.close()\n",
    "        print('insert ok')\n",
    "    except Exception as e:\n",
    "        print(e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "_json = df.to_dict(orient='records')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "insert into user_test(data_set_datail_id,model_name,batch_uuid,data_detail) values(%s,%s,%s,%s)\n",
      "insert ok\n"
     ]
    }
   ],
   "source": [
    "params = []\n",
    "for item in _json:\n",
    "    _list = []\n",
    "    for k,v in item.items():\n",
    "        if k == 'data_set_datail_id':\n",
    "            _list.append(int(v))\n",
    "        else:\n",
    "            _list.append(v)\n",
    "    params.append(_list)\n",
    "myInsert(tuple(params))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'batch_uuid': 'cd46dccf-5697-40ea-ad87-123445534534',\n",
       " 'data_detail': \"{'code': 200, 'data': {'features': {'td_qu_rules': {'state': 200, 'value': [{'score': 5.0, 'conditions': [{'hits': [{'evidenceTime': 1566455155000, 'riskLevelDisplayName': '中', 'value': '532122199302181215', 'fraudTypeDisplayName': '异常绑卡'}, {'evidenceTime': 1554677251000, 'riskLevelDisplayName': '中', 'value': '532122199302181215', 'fraudTypeDisplayName': '异常借款'}, {'evidenceTime': 1554677251000, 'riskLevelDisplayName': '中', 'value': '532122199302181215', 'fraudTypeDisplayName': '申请行为异常'}], 'dimValue': '532122199302181215', 'dimType': 'id_number', 'type': 'grey_list'}], 'ruleId': '2022734'}, {'score': 5.0, 'conditions': [{'hits': [{'evidenceTime': 1566455155000, 'riskLevelDisplayName': '中', 'value': '15284543783', 'fraudTypeDisplayName': '异常绑卡'}, {'evidenceTime': 1554677251000, 'riskLevelDisplayName': '中', 'value': '15284543783', 'fraudTypeDisplayName': '异常借款'}, {'evidenceTime': 1554677251000, 'riskLevelDisplayName': '中', 'value': '15284543783', 'fraudTypeDisplayName': '申请行为异常'}, {'evidenceTime': 1566455043000, 'riskLevelDisplayName': '中', 'value': '15284543783', 'fraudTypeDisplayName': '异常注册'}], 'dimValue': '15284543783', 'dimType': 'account_mobile', 'type': 'grey_list'}], 'ruleId': '2022768'}, {'score': 10.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'count': 1}], 'result': 2.0, 'resultsForDim': [{'dimType': 'account_mobile', 'count': 2}, {'dimType': 'id_number', 'count': 2}], 'type': 'association_partner', 'hitsForDim': [{'industryDisplayName': '一般消费分期平台', 'dimType': 'account_mobile', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'dimType': 'account_mobile', 'count': 1}, {'industryDisplayName': '一般消费分期平台', 'dimType': 'id_number', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'dimType': 'id_number', 'count': 1}]}], 'ruleId': '2022866'}, {'score': 12.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 2}, {'industryDisplayName': '银行个人业务', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'count': 2}, {'industryDisplayName': '综合类电商平台', 'count': 1}], 'result': 6.0, 'resultsForDim': [{'dimType': 'account_mobile', 'count': 5}, {'dimType': 'id_number', 'count': 6}], 'type': 'association_partner', 'hitsForDim': [{'industryDisplayName': '一般消费分期平台', 'dimType': 'account_mobile', 'count': 2}, {'industryDisplayName': '银行个人业务', 'dimType': 'account_mobile', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'dimType': 'account_mobile', 'count': 1}, {'industryDisplayName': '综合类电商平台', 'dimType': 'account_mobile', 'count': 1}, {'industryDisplayName': '一般消费分期平台', 'dimType': 'id_number', 'count': 2}, {'industryDisplayName': '银行个人业务', 'dimType': 'id_number', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'dimType': 'id_number', 'count': 2}, {'industryDisplayName': '综合类电商平台', 'dimType': 'id_number', 'count': 1}]}], 'ruleId': '2022868'}, {'score': 2.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 2}, {'industryDisplayName': '银行个人业务', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'count': 3}, {'industryDisplayName': '综合类电商平台', 'count': 1}], 'result': 7.0, 'resultsForDim': [{'dimType': 'account_mobile', 'count': 6}, {'dimType': 'id_number', 'count': 7}], 'type': 'association_partner', 'hitsForDim': [{'industryDisplayName': '一般消费分期平台', 'dimType': 'account_mobile', 'count': 2}, {'industryDisplayName': '银行个人业务', 'dimType': 'account_mobile', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'dimType': 'account_mobile', 'count': 2}, {'industryDisplayName': '综合类电商平台', 'dimType': 'account_mobile', 'count': 1}, {'industryDisplayName': '一般消费分期平台', 'dimType': 'id_number', 'count': 2}, {'industryDisplayName': '银行个人业务', 'dimType': 'id_number', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'dimType': 'id_number', 'count': 3}, {'industryDisplayName': '综合类电商平台', 'dimType': 'id_number', 'count': 1}]}], 'ruleId': '2022870'}, {'score': 0.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 3}, {'industryDisplayName': '银行个人业务', 'count': 2}, {'industryDisplayName': '银行消费金融公司', 'count': 3}, {'industryDisplayName': '网上银行', 'count': 1}, {'industryDisplayName': 'P2P网贷', 'count': 3}, {'industryDisplayName': '大型消费金融公司', 'count': 2}, {'industryDisplayName': '综合类电商平台', 'count': 1}], 'result': 15.0, 'resultsForDim': [{'originalDimType': 'account_mobile', 'count': 13, 'matchDimType': 'account_mobile'}, {'originalDimType': 'id_number', 'count': 15, 'matchDimType': 'id_number'}], 'eventType': 'Loan', 'type': 'cross_partner', 'hitsForDim': [{'originalDimType': 'account_mobile', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '网上银行', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'P2P网贷', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '大型消费金融公司', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'id_number', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '网上银行', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'P2P网贷', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '大型消费金融公司', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'id_number'}]}], 'ruleId': '2022872'}, {'score': 0.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 3}, {'industryDisplayName': '银行个人业务', 'count': 2}, {'industryDisplayName': '银行消费金融公司', 'count': 3}, {'industryDisplayName': '信用卡中心', 'count': 1}, {'industryDisplayName': '网上银行', 'count': 2}, {'industryDisplayName': 'P2P网贷', 'count': 3}, {'industryDisplayName': '大型消费金融公司', 'count': 2}, {'industryDisplayName': '综合类电商平台', 'count': 1}], 'result': 17.0, 'resultsForDim': [{'originalDimType': 'account_mobile', 'count': 15, 'matchDimType': 'account_mobile'}, {'originalDimType': 'id_number', 'count': 17, 'matchDimType': 'id_number'}], 'eventType': 'Loan', 'type': 'cross_partner', 'hitsForDim': [{'originalDimType': 'account_mobile', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '网上银行', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'P2P网贷', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '大型消费金融公司', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'id_number', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '网上银行', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'P2P网贷', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '大型消费金融公司', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'id_number'}]}], 'ruleId': '2022874'}, {'score': 0.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 3}, {'industryDisplayName': '银行个人业务', 'count': 2}, {'industryDisplayName': '银行消费金融公司', 'count': 3}, {'industryDisplayName': '直销银行', 'count': 1}, {'industryDisplayName': '信用卡中心', 'count': 1}, {'industryDisplayName': '网上银行', 'count': 3}, {'industryDisplayName': 'P2P网贷', 'count': 3}, {'industryDisplayName': '大型消费金融公司', 'count': 2}, {'industryDisplayName': 'O2O', 'count': 1}, {'industryDisplayName': '综合类电商平台', 'count': 1}], 'result': 20.0, 'resultsForDim': [{'originalDimType': 'id_number', 'count': 20, 'matchDimType': 'id_number'}, {'originalDimType': 'account_mobile', 'count': 18, 'matchDimType': 'account_mobile'}], 'eventType': 'Loan', 'type': 'cross_partner', 'hitsForDim': [{'originalDimType': 'id_number', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '直销银行', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '网上银行', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'P2P网贷', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '大型消费金融公司', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'O2O', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '直销银行', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '网上银行', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'P2P网贷', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '大型消费金融公司', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'O2O', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'account_mobile'}]}], 'ruleId': '2022876'}, {'score': 0.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 3}, {'industryDisplayName': '银行个人业务', 'count': 2}, {'industryDisplayName': '银行消费金融公司', 'count': 3}, {'industryDisplayName': '直销银行', 'count': 1}, {'industryDisplayName': '信用卡中心', 'count': 1}, {'industryDisplayName': '网上银行', 'count': 3}, {'industryDisplayName': 'P2P网贷', 'count': 3}, {'industryDisplayName': '大型消费金融公司', 'count': 2}, {'industryDisplayName': 'O2O', 'count': 1}, {'industryDisplayName': '综合类电商平台', 'count': 1}], 'result': 20.0, 'resultsForDim': [{'originalDimType': 'id_number', 'count': 20, 'matchDimType': 'id_number'}, {'originalDimType': 'account_mobile', 'count': 19, 'matchDimType': 'account_mobile'}], 'eventType': 'Loan', 'type': 'cross_partner', 'hitsForDim': [{'originalDimType': 'id_number', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '直销银行', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '网上银行', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'P2P网贷', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '大型消费金融公司', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'O2O', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '一般消费分期平台', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '直销银行', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '网上银行', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'P2P网贷', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '大型消费金融公司', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'O2O', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'account_mobile'}]}], 'ruleId': '2022878'}, {'score': 6.0, 'conditions': [{'hits': [{'industryDisplayName': '一般消费分期平台', 'count': 4}, {'industryDisplayName': '银行个人业务', 'count': 2}, {'industryDisplayName': '银行消费金融公司', 'count': 3}, {'industryDisplayName': '直销银行', 'count': 1}, {'industryDisplayName': '信用卡中心', 'count': 1}, {'industryDisplayName': '网上银行', 'count': 3}, {'industryDisplayName': 'P2P网贷', 'count': 4}, {'industryDisplayName': '大型消费金融公司', 'count': 2}, {'industryDisplayName': 'O2O', 'count': 1}, {'industryDisplayName': '综合类电商平台', 'count': 1}], 'result': 22.0, 'resultsForDim': [{'originalDimType': 'account_mobile', 'count': 21, 'matchDimType': 'account_mobile'}, {'originalDimType': 'id_number', 'count': 22, 'matchDimType': 'id_number'}], 'eventType': 'Loan', 'type': 'cross_partner', 'hitsForDim': [{'originalDimType': 'account_mobile', 'industryDisplayName': '一般消费分期平台', 'count': 4, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '直销银行', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '网上银行', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'P2P网贷', 'count': 3, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '大型消费金融公司', 'count': 2, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': 'O2O', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'account_mobile', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'account_mobile'}, {'originalDimType': 'id_number', 'industryDisplayName': '一般消费分期平台', 'count': 4, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行个人业务', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '银行消费金融公司', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '直销银行', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '信用卡中心', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '网上银行', 'count': 3, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'P2P网贷', 'count': 4, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '大型消费金融公司', 'count': 2, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': 'O2O', 'count': 1, 'matchDimType': 'id_number'}, {'originalDimType': 'id_number', 'industryDisplayName': '综合类电商平台', 'count': 1, 'matchDimType': 'id_number'}]}], 'ruleId': '2022880'}]}}}}\",\n",
       " 'data_set_datail_id': 14,\n",
       " 'model_name': 'tongdun_feature'}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "_json[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>data_set_datail_id</th>\n",
       "      <th>model_name</th>\n",
       "      <th>batch_uuid</th>\n",
       "      <th>data_detail</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>14</td>\n",
       "      <td>tongdun_feature</td>\n",
       "      <td>cd46dccf-5697-40ea-ad87-dea8fe1db689</td>\n",
       "      <td>{'state': 200, 'value': [{'conditions': [{'dim...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   data_set_datail_id       model_name                            batch_uuid  \\\n",
       "0                  14  tongdun_feature  cd46dccf-5697-40ea-ad87-dea8fe1db689   \n",
       "\n",
       "                                         data_detail  \n",
       "0  {'state': 200, 'value': [{'conditions': [{'dim...  "
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
