import pandas as pd
%matplotlib inline
import matplotlib
matplotlib.style.use('ggplot')
podaci=pd.read_excel("MAT1.xls")
def frekvencije(tablica,varijabla):
freq=tablica[varijabla].value_counts().sort_index()
rel_freq=freq/tablica[varijabla].count()
return pd.DataFrame({"frekvencije":freq,"relativne frekvencije":rel_freq})
frek_KOL1=frekvencije(podaci,"KOL1")
frek_KOL1['frekvencije'].plot(kind='bar',grid=True,colormap='Accent');
frek_KOL1['relativne frekvencije'].plot(kind='bar',grid=True,colormap='Accent');
frek_KOL2=frekvencije(podaci,"KOL2")
frek_KOL2['frekvencije'].plot(kind='bar',grid=True,colormap='Accent');
frek_KOL2['relativne frekvencije'].plot(kind='bar',grid=True,colormap='Accent');
frek_KOL3=frekvencije(podaci,"KOL3")
frek_KOL3['frekvencije'].plot(kind='bar',grid=True,colormap='Accent');
frek_KOL3['relativne frekvencije'].plot(kind='bar',grid=True,colormap='Accent');
frek_Ocjena=frekvencije(podaci,"Ocjena")
frek_Ocjena['frekvencije'].plot(kind='bar',grid=True,colormap='Accent');
frek_Ocjena['frekvencije'].plot(kind='pie',grid=True,colormap='Accent',autopct='%.2f',figsize=[6,6]);
podaci.plot(kind='scatter', x='KOL1', y='KOL2',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL1', y='KOL3',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL2', y='KOL3',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL1', y='Aktivnost',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL2', y='Aktivnost',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL3', y='Aktivnost',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL1', y='Ocjena',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL2', y='Ocjena',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='KOL3', y='Ocjena',grid=True,c="red",s=30);
podaci.plot(kind='scatter', x='Aktivnost', y='Ocjena',grid=True,c="red",s=30);
podaci[["KOL1","KOL2","KOL3","Aktivnost","Ocjena"]].corr(method='pearson')