Untitled
zohaib bahi meri path gyiunknown
c_cpp
4 months ago
663 B
3
Indexable
import pandas as pd filepath = "EmployeeRecord.csv" employee_data = pd.read_csv(filepath) print(employee_data.head()) employee_data['Salary'] = (employee_data['Years of Experience'] > 10).astype(int) data = employee_data[['Education Level', 'Years of Experience', 'Job Title', 'Salary']] from sklearn.preprocessing import LabelEncoder label_encoder_edu = LabelEncoder() label_encoder_job = LabelEncoder() data['Education Level'] = label_encoder_edu.fit_transform(data['Education Level']) data['Job Title'] = label_encoder_job.fit_transform(data['Job Title']) X = data[['Education Level', 'Years of Experience', 'Job Title']] y = data['Salary']
Editor is loading...
Leave a Comment