Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 21, 2023
1 parent 58bc705 commit dceca35
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions examples/other_datasets/plot_financial_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,15 @@
# 1) Not correlated
# 2) Sufficiently descriminant (based on the number of unique values)
# 3) Are not "empty"
channels = ["IP_TERMINAL", "FK_CONTRATO_PPAL_OPE", "SALDO_ANTES_PRESTAMO", "FK_NUMPERSO", "FECHA_ALTA_CLIENTE", "FK_TIPREL"]
digest = ["IP", "Contract code", "Balance", "ID", "Seniority", "Ownership"]
channels = [
"IP_TERMINAL",
"FK_CONTRATO_PPAL_OPE",
"SALDO_ANTES_PRESTAMO",
"FK_NUMPERSO",
"FECHA_ALTA_CLIENTE",
"FK_TIPREL",
]
digest = ["IP", "Contract code", "Balance", "ID", "Seniority", "Ownership"]
features = dataset[channels]
target = dataset.FRAUD

Expand All @@ -79,11 +86,11 @@
print(f"number of genuine loans: {target[target == 0].size}")

# Simple treatement for NaN value
features.fillna(method='ffill', inplace=True)
features.fillna(method="ffill", inplace=True)

# Convert date value to linux time
features['FECHA_ALTA_CLIENTE'] = pd.to_datetime(features['FECHA_ALTA_CLIENTE'])
features['FECHA_ALTA_CLIENTE'] = features['FECHA_ALTA_CLIENTE'].apply(lambda x: x.value)
features["FECHA_ALTA_CLIENTE"] = pd.to_datetime(features["FECHA_ALTA_CLIENTE"])
features["FECHA_ALTA_CLIENTE"] = features["FECHA_ALTA_CLIENTE"].apply(lambda x: x.value)

# Let's encode our categorical variable (LabelEncoding):
features["IP_TERMINAL"] = features["IP_TERMINAL"].astype("category").cat.codes
Expand Down

0 comments on commit dceca35

Please sign in to comment.