text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd

data = pd.read_csv('/kaggle/input/loan-data-set/loan_data_set.csv')

data.drop('Loan_ID', axis=1, inplace=True)

data.shape

data = data.dropna()

data.shape

le = LabelEncoder()
data['Gender'] = le.fit_transform(data['Gender'])
data['Married'] = le.fit_transform(data['Married'])
data['Dependents'] = le.fit_transform(data['Dependents'])
data['Education'] = le.fit_transform(data['Education'])
data['Self_Employed'] = le.fit_transform(data['Self_Employed'])
data['Property_Area'] = le.fit_transform(data['Property_Area'])
data['Loan_Status'] = le.fit_transform(data['Loan_Status'])

new_data = pd.read_csv('/path/to/new/data.csv')
new_data.drop('Loan_ID', axis=1, inplace=True)
new_data['Gender'] = le.transform(new_data['Gender'])
new_data['Married'] = le.transform(new_data['Married'])
new_data['Education'] = le.transform(new_data['Education'])
new_data['Self_Employed'] = le.transform(new_data['Self_Employed'])
new_data['Property_Area'] = le.transform(new_data['Property_Area'])