#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# pylint: disable=W1401
"""
Created on Mon Nov 6 21:04:24 2017
@author: lu
"""
import numpy as np
import pandas as pd
from sqlalchemy import create_engine
"""
This part of the code mainly uses Python Connect to database , Extract data for analysis .
the j So before you run the code, you need to say sql Statement to insert data into mysql In the database
Note that you need to create one in advance database, And add the use of... At the beginning database The sentence of
mysql -uroot -p < 7law.sql
Need to wait for a while
This part of the code did not run , There are certain problems
count107--> Statistics 107 Category
programmer_1--> Have a general understanding of the intention of processing data
programmer_2--> Extract required data , And save it to the database
programmer_3--> Data filtering , Save to the database
programmer_4--> Merge certain features into one feature , Save to database
programmer_5--> Recommendation matrix
"""
def count107(i):
j = i[["fullURL"]][i["fullURLId"].str.contains("107")].copy()
# Add an empty column
j["type"] = None
# Use regular to match , And rename
j["type"][j["fullURL"].str.contains("info/.+?/")] = u" Knowledge home page "
j["ty