<jupyter_start><jupyter_text>Pagueveloz<jupyter_code>engine = create_engine("mysql+pymysql://capMaster:#jackpot123#<EMAIL>:23306/varejo")
con = engine.connect()
dfpv = pd.read_sql("select distinct cpf_cnpj from fluxo_pv", con)
con.close()
dfpv["flag_cnpj"] = dfpv.apply(lambda x : int(len(x["cpf_cnpj"])==18), axis=1)
cnpj_pv = dfpv[dfpv["flag_cnpj"]==1]["cpf_cnpj"].tolist()
cnpj_pv = cnpj_pv[1:]
cnpj_pv = [el.replace(".", "").replace("/", "").replace("-", "") for el in cnpj_pv]
resp = []
fr = []
err = []
for el in tqdm_notebook(cnpj_pv):
    try:
        ds = DScoring(cnpj=el, produto='pagueveloz')
        scores, dfcalc = ds.calcula()
        resp.append({el : scores})
        dfcalc["cnpj"] = el
        fr.append(dfcalc)
    except:
        err.append(el)
dfcalc_pv = pd.concat(fr)
dfcalc_pv.head()
dfcalc_pv.rename(columns={'dscore' : 'dscore_segmento'}, inplace=True)
dfcalc_pv["produto"] = "pagueveloz"
dfcalc_pv["data_ref"] = datetime.now().date()
engine = create_engine("mysql+pymysql://capMaster:#jackpot123#<EMAIL>:23306/credit_model")
con = engine.connect()
dfcalc_pv.to_sql("debt_score", schema="credit_model", con=con, if_exists='append', index=False)
dfcalc_pv[dfcalc_pv["cnpj"]=="61353025000163"]
dfcalc_pv.shape
dfcalc_pv.drop_duplicates(inplace=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18773946360153257, 'fraction_numerical': 0.02681992337164751, 'mean_word_length': 6.136612021857924, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '131288', 'license': 'MIT', 'n_tokens_mistral': 565, 'n_tokens_neox': 541, 'n_words': 72, 'path': 'Modelagem/Score Divida Justa/calculo_lambda.ipynb', 'repo_name': 'lsawakuchi/x1', 'size': '1391'}