<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
import nltk
df = pd.read_csv('premin10.csv', engine='python', encoding='utf-8', error_bad_lines=False)
df = df[['id', 'author', 'body_pp_4', 'subreddit', 'title']]
df = df[df['body_pp_4'].notnull()]
df = df.loc[:, ~df.columns.str.contains('^Unnamed')]
from nltk.sentiment.vader import SentimentIntensityAnalyzer
nltk.download('vader_lexicon')
analyzer = SentimentIntensityAnalyzer()
df['compound'] = [analyzer.polarity_scores(x)['compound'] for x in df['body_pp_4']]
df['neg'] = [analyzer.polarity_scores(x)['neg'] for x in df['body_pp_4']]
df['neu'] = [analyzer.polarity_scores(x)['neu'] for x in df['body_pp_4']]
df['pos'] = [analyzer.polarity_scores(x)['pos'] for x in df['body_pp_4']]
df
print(df['compound'].mean())
print(df['neg'].mean())
print(df['neu'].mean())
print(df['pos'].mean())
df.to_csv('sent10.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2156215621562156, 'fraction_numerical': 0.0121012101210121, 'mean_word_length': 9.224719101123595, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '571203', 'license': 'MIT', 'n_tokens_mistral': 375, 'n_tokens_neox': 368, 'n_words': 59, 'path': 'VADER_Sentiment.ipynb', 'repo_name': 'koseii2122/Reddit-Vaccine-Data', 'size': '909'}