Correlatino between categotical and binary variable in pyton
Answers
Answered by
0
Answer:
C program for no.Of days remaining in a year for the given date and month of a year
Answered by
0
import pandas as pd
import numpy as np
num1=np.random.normal(loc=60,scale=5,size=100)
df1=pd.DataFrame(num1,columns=['Salary'])
df1['Type']='EmpType1'
num2=np.random.normal(loc=50,scale=5,size=100)
df2=pd.DataFrame(num2,columns=['Salary'])
df2['Type']='EmpType2'
df=pd.concat([df1,df2],axis=0)
# Since Categorical variable 'Type' has only 2 values we will convert it into numeric (0 and 1) datatype.
df['TypeInt']=(df['Type']=='EmpType1').astype(int)
df.corr()
Similar questions