
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Year 2023, Python for Data analysis cheat sheet
Typology: Cheat Sheet
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Group the data by different categories of an
ribute, displaying the average value of numerical
ributes with the same category.
Group the data by different categories of multiple
ributes, displaying the average value of numerical
ributes with the same category.
eate Pivot tables for better representation of data
sed on parameters
eate a heatmap image using a PsuedoColor plot (or
olor) using the pivot table as data.
lculate the Pearson Coefficient and p-value of a pair
attributes
a.
df_group =
df_group.groupby(['attribute_1'],as_index=False).mean()
b.
df_group = df_group.groupby(['attribute_1',
'attribute_2'],as_index=False).mean()
grouped_pivot =
df_group.pivot(index='attribute_1',columns='attribute_2')
from matlplotlib import pyplot as plt
plt.pcolor(grouped_pivot, cmap='RdBu')
From scipy import stats
pearson_coef,p_value=stats.pearsonr(df['attribute_1'],
df['attribute_2'])