From 4aa332323a7874d2be1992bdd2ab68a484ce98c0 Mon Sep 17 00:00:00 2001 From: Interdonato Roberto <roberto.interdonato@cirad.fr> Date: Fri, 24 Jan 2020 12:02:05 +0100 Subject: [PATCH] Upload New File --- boxplot_distancwords.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 boxplot_distancwords.py diff --git a/boxplot_distancwords.py b/boxplot_distancwords.py new file mode 100644 index 0000000..fd4e32e --- /dev/null +++ b/boxplot_distancwords.py @@ -0,0 +1,35 @@ +import numpy as np +import pandas as pd +from os import path +from PIL import Image +import wordcloud +import matplotlib.pyplot as plt +import string +import datetime +from nltk.corpus import stopwords +import glob +from os.path import basename +import matplotlib.pyplot as plt + +def gen_boxplot(input_f,outname): + df = pd.read_csv(input_f, sep=';') + vals = df.iloc[:,1] + + # Create a figure instance + fig = plt.figure(1, figsize=(9, 6)) + + # Create an axes instance + ax = fig.add_subplot(111) + + # Create the boxplot + bp = ax.boxplot(vals) + + # Save the figure + fig.savefig(outname, bbox_inches='tight') + fig.clear() + +files=glob.glob('./distance_words_*.csv') + +for f in files: + print(f) + gen_boxplot(f,basename(f).split('.')[0]+'.png') -- GitLab