text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd

dataset = pd.read_csv('../input/stroke-prediction-dataset/healthcare-dataset-stroke-data.csv')

objList = dataset.select_dtypes(include='object').columns

from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
for feat in objList:
    dataset[feat] = le.fit_transform(dataset[feat].astype(str))

dataset.head()