diff --git a/pymath/stat/weightedDataset.py b/pymath/stat/weightedDataset.py index 1727891..3c0131c 100644 --- a/pymath/stat/weightedDataset.py +++ b/pymath/stat/weightedDataset.py @@ -149,61 +149,23 @@ class WeightedDataset(dict): # Rendu latex def tabular_latex(self): - """ Renvoie le code latex pour afficher le tableau + """ Latex code to display dataset as a tabular """ + latex = "\\begin{{tabular}}{{|c|*{{{nbr_col}}}{{c|}}}} \n".format(nbr_col = len(self.keys())) + latex += "\t \hline \n" + data_line = "\t {data_name} ".format(data_name = self.data_name) + weight_line = "\t {weight_name} ".format(weight_name = self.weight_name) - :return : le code latex pour afficher le tableau - """ - latex = "\\begin{{center}} \n \t \\begin{{tabular}}{{|c|*{{{nbr_col}}}{{c|}}}} \n".format(nbr_col = len(self.serie)) - latex += "\t\t \hline \n" - latex += "\t\t {val_name} ".format(val_name = self.val_name) - eff_ligne = "\t\t {eff_name} ".format(eff_name = self.eff_name) + # TODO: Il faudra trouver une solution pour le formatage des données |sam. janv. 9 13:14:26 EAT 2016 + for (v,e) in self.items(): + data_line += "& {val} ".format(val = v) + weight_line += "& {eff} ".format(eff = e) - for (v,e) in self.serieCouple: - latex += "& {val:.2f} ".format(val = v) - eff_ligne += "& {eff:.2f} ".format(eff = e) - - latex += "\\\\ \hline \n" - latex += eff_ligne + " \\\\ \hline \n" - latex += "\t \\end{tabular} \n \\end{center}" + latex += data_line + "\\\\ \n \t \\hline \n" + latex += weight_line + "\\\\ \n \t \\hline \n" + latex += "\\end{tabular}" return latex -if __name__ == '__main__': - valeurs = [65, 75, 85, 95, 105, 115, 125, 135] - valeurs.sort() - print(valeurs) - effectifs = [ 15, 2, 21, 24, 12, 9, 5, 2] - - - s = Serie() - - s.set_values(valeurs, effectifs) - print(s.effectif_total) - - print(s.valeurs) - print(s.effectifs) - print(s.serie) - - # print(s.tabular_latex()) - - # print("Moyenne ", s.moyenne()) - # print(s.variance()) - # print(s.ecart_type()) - - print("\n-----------------------\n") - print(s.moyenne_latex()) - print("\n-----------------------\n") - print(s.variance_latex()) - print("\n-----------------------\n") - print(s.ecart_type_latex()) - - # print(s.quartiles()) - print("\n-----------------------\n") - print(s.quartile_latex()) - print(s.quartile_latex(1)) - print(s.quartile_latex(3)) - - # ----------------------------- # Reglages pour 'vim'