I require help with a for loop I was creating to plot different figures based on if a variable were numeric or categorical.
So far, the issue I have is the if statement not working. I am not sure why, it looks like a simple thing: if the dtypes is numeric, do a boxplot, else do another thing. Why is this simple thing not being solved?
f, axes = plt.subplots(4,2, figsize = (40,40))
count1 = 0
count2 = 2
for var in numdata:
temp = pd.DataFrame(data[var])
if temp.dtypes == 'int64':
sb.boxplot(x = var, data = numdata, orient = 'h', color = 'r', ax = axes[count1, 0])
sb.histplot(x = var, data = numdata, color = 'g', ax = axes[count1, 1])
count1 += 1
else:
sb.catplot(y = var, data = numdata, kind = 'count', ax = axes[count2,0])
sb.boxplot(x = var, y = 'SalePrice', data = numdata, ax = axes[count2,1])
count2 += 1