<jupyter_start><jupyter_text>Must take care about what the algorithm classifies a positive and negative sentiment due keywords It's far from perfect<jupyter_code># Plotting the polarity ans subjectivity

plt.figure(figsize=(8,6))
for i in range(0, bill.shape[0]):
    plt.scatter(bill['Polarity'][i], bill['Subjectivity'][i], color='Blue')
    
plt.title('Sentiment Analysis')
plt.xlabel('Polarity')
plt.ylabel('Subjectivity')
plt.show()
# Get the percentage of positive, negative and neutral tweets

#ptweets = bill[bill.Analysis == 'Positive']
ptweets = bill[bill['Analysis'] == 'Positive'].shape[0]
ntweets = bill[bill['Analysis'] == 'Negative'].shape[0]
neutral = bill[bill['Analysis'] == 'Neutral'].shape[0]
print(f'Number of positive tweets: {ptweets}')
print(f'Number of negative tweets: {ntweets}')
print(f'Number of neutral tweets: {neutral}\n')

print(f'Percentagem of positive tweets: {ptweets / bill.shape[0]:.2f}')
print(f'Percentagem of negative tweets: {ntweets / bill.shape[0]:.2f}')
print(f'Percentagem of neutral tweets: {neutral / bill.shape[0]:.2f}')
# Or easier way than the cell above: Show Value_counts

bill['Analysis'].value_counts()
# Plot

plt.title("Sentiment Analysis")
plt.xlabel("Sentiment")
plt.ylabel('Counts')
bill['Analysis'].value_counts().plot(kind='bar')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16429107276819205, 'fraction_numerical': 0.009752438109527382, 'mean_word_length': 7.084848484848485, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '291497', 'license': 'MIT', 'n_tokens_mistral': 473, 'n_tokens_neox': 443, 'n_words': 109, 'path': 'First sentiment analysis attempt - Bill Gates.ipynb', 'repo_name': 'k-marcelino/Twitter---Sentiment-Analysis', 'size': '1333'}