text_plain_output_1.png
from sklearn.preprocessing import LabelEncoder

import pandas as pd

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

import pandas as pd
df = pd.read_csv('../input/machine-predictive-maintenance-classification/predictive_maintenance.csv')

df_pass = df[df['Target'] == 0]
df_pass = df_pass[df_pass['Failure Type'] == 'No Failure']
df_fail = df[df['Target'] == 1]
df_fail = df_fail[df_fail['Failure Type'] != 'No Failure']
df1 = df[df['Failure Type'] == 'Heat Dissipation Failure']
df2 = df[df['Failure Type'] == 'Power Failure']
df3 = df[df['Failure Type'] == 'Overstrain Failure']
df4 = df[df['Failure Type'] == 'Tool Wear Failure']
df5 = df[df['Failure Type'] == 'Random Failures ']

df_fail = df_fail.drop(columns=['Air temperature [K]', 'Process temperature [K]', 'Rotational speed [rpm]', 'Torque [Nm]', 'Tool wear [min]', 'Product ID', 'UDI', 'Temp_diff', 'td', 'Target'])

df_fail = pd.get_dummies(data=df_fail, columns=['Type'], drop_first=True)
scaler = LabelEncoder()
df_fail['Failure Type'] = scaler.fit_transform(df_fail['Failure Type'])

df_fail_targ = df_fail_train = df_fail.iloc[:, 0]
df_fail_train = df_fail.iloc[:, 1:]

df_fail_targ