text:
Q: vaderSentiment TypeError: 'float' object is not iterable I have a twitter dataset and want to do sentiment analysis using VaderSentiment. I want to iterate over the column where the preprocessed tweets are but get TypeError.
My code is like this
!pip install vaderSentiment
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import time
import re
import warnings
warnings.filterwarnings('ignore')

from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
analyzer = SentimentIntensityAnalyzer()
df=pd.read_csv("full_data.csv", parse_dates=['Date'],engine='python')

scores = []
# Declare variables for scores
compound_list = []
positive_list = []
negative_list = []
neutral_list = []
for i in range(df['PreProcessed_Tweets'].shape[0]):
#print(analyser.polarity_scores(sentiments_pd['text'][i]))
    compound = analyzer.polarity_scores(df['PreProcessed_Tweets'][i])["compound"]
    pos = analyzer.polarity_scores(df['PreProcessed_Tweets'][i])["pos"]
    neu = analyzer.polarity_scores(df['PreProcessed_Tweets'][i])["neu"]
    neg = analyzer.polarity_scores(df['PreProcessed_Tweets'][i])["neg"]

    scores.append({"Compound": compound,
                       "Positive": pos,
                       "Negative": neg,
                       "Neutral": neu
                  })

sentiments_score = pd.DataFrame.from_dict(scores)
df = df.join(sentiments_score)
df.head(20)

The error message:
TypeError: 'float' object is not iterable
How can I deal with this error?

A: I think you try to use a float in your range()
Look at this variable :
df['PreProcessed_Tweets'].shape[0]
Regards,


text:
NHS London (or "London Strategic Health Authority") was a strategic health authority of the National Health Service in England.  It operated in the London region, which is coterminous with the local government office region. The authority closed as part of the Health and Social Care Act 2012 on 31 March 2013.

NHS London provided strategic leadership for all of the NHS health services in the capital. NHS London overall responsibility for the performance of 31 Primary care trusts,  in 6 clusters, 20 acute trusts, three mental health trusts and the London Ambulance Service. A further 16 trusts in London are self-governing as foundation trusts.

Its first Chair was George Greener, who was replaced after his resignation in September 2008 with Sir Richard Sykes. The final Chief Executive was Ruth Carnall.

Richard Sykes resigned as Chair in May 2010 over the incoming government's decision to halt planned hospital reorganisations in London, which included closure of A&E and maternity units and the building of new polyclinics.

Professor Mike Spyer, became the Interim Chair of the Board in 2010 and was confirmed as the permanent chair in 2011.

Healthcare for London
In December 2006 NHS London asked Professor Sir Ara Darzi to "develop a strategy to meet Londoners' health needs over the next five to ten years".  The report Healthcare for London: A Framework for Action was published on 11 July 2007.

The Healthcare for London strategy has been discontinued since the change of government in May 2010, however a number of pan-London NHS programmes remain within London Health Programmes http://www.londonhp.nhs.uk/

References

External links
Official website
Healthcare for London

London
2013 disestablishments in England

redpajama_set_name: RedPajamaWikipedia