<jupyter_start><jupyter_text>Generate a unique user table<jupyter_code>import pandas as pd
import numpy as np
import psycopg2
import pymongo
import json
import datetime
import pickle
import functions as fn
import psycopg2
import io
from sqlalchemy import create_engine
# load the above mentioned pickle
with open('initial_5pct_transactions.pkl', 'rb') as f:
    initial_5pct = pickle.load(f)<jupyter_output><empty_output><jupyter_text>Generate a unique user table<jupyter_code>unique_users = fn.get_unique_user_table(initial_5pct)
f'There are currently {len(unique_users)} unique users.'<jupyter_output><empty_output><jupyter_text>Dropping resulting users table into the venmo_transactions db<jupyter_code>def get_keys(path):
    with open(path) as f:
        return json.load(f)
    
keys = get_keys("/Users/jjherranzsarrion/.secret/local_info.json")
username = keys['username']
password = keys['password']
# Move unique user table into database
engine = create_engine(f'postgresql://{username}:{password}@localhost/venmo_transactions')
unique_users.to_sql('users', engine)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09329710144927536, 'fraction_numerical': 0.004528985507246377, 'mean_word_length': 7.435114503816794, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '546088', 'license': 'MIT', 'n_tokens_mistral': 366, 'n_tokens_neox': 361, 'n_words': 87, 'path': 'data_prep_users.ipynb', 'repo_name': 'fromdatavistodatascience/venmo', 'size': '1104'}