<jupyter_start><jupyter_text>Settings<jupyter_code>reviews_path = 'C:\\Data\\UCL\\@MSc Project - Data and sources\\reviews.csv'
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

from os.path import join
from datetime import datetime

from wordcloud import WordCloud

%matplotlib inline<jupyter_output><empty_output><jupyter_text>Load the data<jupyter_code>reviews = pd.read_csv(reviews_path)

min_date = datetime.strptime('2018-7-1', '%Y-%m-%d')
max_date = datetime.strptime('2020-6-30', '%Y-%m-%d')
reviews['Date'] = pd.to_datetime(reviews.Date)

reviews = reviews[(reviews.Date >= min_date) & (reviews.Date <= max_date)]

reviews['Review'] = reviews['Pros'] + ' ' + reviews['Cons']
reviews['Review'] = reviews['Review'].astype('str')<jupyter_output><empty_output><jupyter_text>WordCloud<jupyter_code>text = ' '.join(reviews['Review'])

wordcloud = WordCloud(
    width=1000,
    height=1000,
    background_color='white',
    min_font_size = 15,
    max_font_size = 100,
    max_words = 100,
).generate(text)
plt.figure(figsize=(12,12))

plt.imshow(wordcloud, facecolor=None)
plt.axis("off")
plt.show()
plt.figure(figsize=(12,12))

plt.imshow(wordcloud)
plt.axis("off")
plt.tight_layout(pad = 0) 


plt.savefig('C:\\Data\\UCL\\@MSc Project - Data and sources\Images\wordcloud.png')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1647940074906367, 'fraction_numerical': 0.02846441947565543, 'mean_word_length': 6.031578947368421, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '173807', 'license': 'MIT', 'n_tokens_mistral': 539, 'n_tokens_neox': 499, 'n_words': 81, 'path': 'Exploration/Reviews - wordcloud.ipynb', 'repo_name': 'stancld/MSc-Project', 'size': '1335'}