One-hot encoding turns each category into a separate binary feature, letting categorical transaction types enter a classical fraud-detection model without imposing a numerical order. section 3.3.3
A practical workflow is:
- Compare encoding choices. Ordinal encoding is unsuitable when transaction types have no inherent order; target encoding may miss nuanced differences between CASH_OUT and TRANSFER. section 3.3.3
- Create one column per transaction type, such as CASH_IN, CASH_OUT, DEBIT, PAYMENT, and TRANSFER, using integer binary values. section 3.3.3
- Append the generated columns to the dataframe, select relevant features, discard the original type column, and sort feature names for consistent training and inference. section 3.3.3
- Engineer a categorical feature from the first character of nameDest, inspect its fraud distribution, then encode categoryDest the same way. section 3.6.1
Encoding transaction type with pandas
Use pd.get_dummies(df["type"]).astype(int) to create integer indicator columns, then concatenate them with df using pd.concat(..., axis=1).









