text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

train = pd.read_csv('/kaggle/input/sf-crime/train.csv.zip')
test = pd.read_csv('/kaggle/input/sf-crime/test.csv.zip')

train.isnull().sum()

train.drop(['Dates', 'Category', 'Descript', 'DayOfWeek', 'Address'], inplace=True, axis=1)
test.drop(['Id', 'Dates', 'DayOfWeek', 'Address'], inplace=True, axis=1)

train.nunique()

from sklearn.preprocessing import LabelEncoder
le_PdDistrict = LabelEncoder()
le_Resolution = LabelEncoder()
le_X = LabelEncoder()
le_Y = LabelEncoder()

train['PdDistrict'] = le_PdDistrict.fit_transform(train['PdDistrict'])
train['Resolution'] = le_PdDistrict.fit_transform(train['Resolution'])
train['X'] = le_PdDistrict.fit_transform(train['X'])
train['Y'] = le_PdDistrict.fit_transform(train['Y'])

test['PdDistrict'] = le_PdDistrict.transform(test['PdDistrict'])
test['X'] = le_PdDistrict.transform(test['X'])
test['Y'] = le_PdDistrict.transform(test['Y'])