<jupyter_start><jupyter_text>One Hot & Bin The continious Variables<jupyter_code>from utils import *
import pandas as pd
import numpy as np
df = pd.read_pickle('TU_final')
categorical = ['HomeAdrNUTS', 'HomeAdrMunCode',  'RespSex', 'RespPrimOcc', 'RespEdulevel', 'RespHasBicycle',
              'RespHasSeasonticket', 'ResphasDrivlic', 'Handicap', 'HousehAccomodation', 'PosInFamily', 'NuclFamType',
              'HousehAccOwnorRent', 'HousehCarOwnership']
numerical = [ 'RespAgeCorrect', 'RespDrivlicYear', 'HousehNumcars', 
             'HousehNumPers',
             'HousehNumAdults', 'HousehNumPers1084', 'HousehNumPersO6',
             'HousehNumDrivLic']

df_cat = df

numerical_binning(df_cat, numerical, q=10)
df_onehot = encode_onehot(df_cat, categorical + numerical)
df_onehot.head()
print(len(numerical + categorical), len(df.columns))
df_onehot.to_pickle('TU_onehot')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12747252747252746, 'fraction_numerical': 0.007692307692307693, 'mean_word_length': 5.460992907801418, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '439033', 'license': 'MIT', 'n_tokens_mistral': 359, 'n_tokens_neox': 326, 'n_words': 56, 'path': 'Code/1_Preprocessing_part_2.ipynb', 'repo_name': 'carlomarxdk/GAN-Population-Synthesis', 'size': '910'}