我试图用下面的代码创建虚拟变量
cat_vars=['Gender', 'Recidence', 'CivilStatus', 'HighestEducationQualification', 'ExtraCurricularActivities', 'ApparelRelatedVocationalQualification', 'PreviouseJob', 'ExperienceSection', 'RelativesInApparel', 'SpousesOccupation', 'FamilyOppinionAboutTheJob', 'ExpectationOfDoingTheJob', 'AvailabilityOfTransportNearTheResidence', 'ReasonForChooseApparel', 'PreviousWorkPlace', 'ContributionToTheFamilyIncome', 'PersonalImpression', 'AccommodationFee', 'RetentionCategory', 'SelectedDepartment', 'ChildrenLessThan5Years', 'NumberOfChilren', 'ApparelExperience', 'ReasonForLeaving', 'MedicalTest', 'ExpectedSalary', 'ExperienceDurationMonths', 'IQTestScore', 'LastBasicSalary', 'InterviewedBy', 'FollowingExternalCourses', 'Is_Rejoined_Employee__c']
for var in cat_vars:
cat_list='var'+'_'+var
cat_list = pd.get_dummies(df[var], prefix=var)
data1=df.join(cat_list)
但它不断抛出这个错误
columns overlap but no suffix specified: Index(['Gender_Female', 'Gender_Male'], dtype='object')
目前没有回答
相关问题 更多 >
编程相关推荐