The Point that you're missing
Tips for your data analysis and AI code
# 1. Easy on your eyes, easy to your analysis
sns.countplot(data=df , x ='target_column', hue='satisfaction')
df['target_column'].value_counts().plot(kind='bar')
# 2. Save time
df['Bool'].loc[df['Bool'] == 1] = 'Y'
df['Bool'].loc[df['Bool'] == 0] = 'N'
# 3. Don't forget to invers transforming
le = LabelEncoder()
df['column'] = le.fit_transform(df['column'])
le.inverse_transform(result)
# 4. Why not pretty?
corr_data = df.corr()
fig, ax = plt.subplots(figsize=(12,10))
mask = np.zeros_like(corr_data)
mask[np.triu_indices_from(mask)] = True
sns.heatmap(corr_data,
annot = True,
mask=mask,
linewidths=1.,
cbar_kws={"shrink": .5},
vmin = -1,
vmax = 1
)
plt.show()
Comments
Post a Comment