Answers for "categorical mean encoding in python"

0

categorical mean encoding in python

df.groupby(['SubjectName'])['Target'].mean()
Posted by: Guest on June-26-2021
0

categorical mean encoding in python

Mean_encoded_subject = df.groupby(['SubjectName'])['Target'].mean().to_dict()
  
df['SubjectName'] =  df['SubjectName'].map(Mean_encoded_subject)
  
print(df)
Posted by: Guest on June-26-2021

Code answers related to "categorical mean encoding in python"

Python Answers by Framework

Browse Popular Code Answers by Language