#+TITLE: Exo 4 #+AUTHOR: Lana Huong Scravaglieri #+DATE: 2023-11-09 #+LANGUAGE: fr # #+PROPERTY: header-args :eval never-export #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: * Get data #+begin_src python :results output :session :exports both import numpy as np data = np.loadtxt("data.csv", delimiter=",", dtype=float) #+end_src #+RESULTS: * Basic statistics #+begin_src python :results output :session :exports both print("Mean : ", np.mean(data)) print("Std : ", np.std(data, ddof=1)) print("Min : ", np.min(data)) print("Median : ", np.median(data)) print("Max : ", np.max(data)) #+end_src #+RESULTS: : Mean : 14.113000000000001 : Std : 4.334094455301447 : Min : 2.8 : Median : 14.5 : Max : 23.4 * Graphs ** Sequence plot #+begin_src python :results file :session :exports both :var fname="seq-plot.png" import matplotlib.pyplot as plt import seaborn as sb x = np.linspace(0,data.size, 100) plt.figure(figsize=(10,5)) sb.lineplot(x=x, y=data) plt.tight_layout() plt.savefig(fname) plt.close() fname #+end_src #+RESULTS: [[file:seq-plot.png]] ** Frequency plot #+begin_src python :results file :session :exports both :var fname="hist-plot.png" import matplotlib.pyplot as plt plt.figure(figsize=(10,5)) sb.histplot(data=data) plt.tight_layout() plt.savefig(fname) plt.close() fname #+end_src #+RESULTS: [[file:hist-plot.png]]