Wrong output from sentiment analysis?How to flush output of print function?How to randomly select an item from a list?How do you read from stdin?Why is reading lines from stdin much slower in C++ than Python?How to remove a key from a Python dictionary?Adding scores of sentences depending on region Python very lostPython: How to total of the scores for all the tweets in a region divided by the number of tweets (Lots of info provided,)Completing a function to add Values depending on specific “Regions” (More info provided)The procedure to matching words from a list to words in a lineWhy am I getting a syntax error for my elif statement?

What was the point of separating stdout and stderr?

A quine of sorts

Why are examinees often not allowed to leave during the start and end of an exam?

Does a lens with a bigger max. aperture focus faster than a lens with a smaller max. aperture?

Calculus, water poured into a cone: Why is the derivative non-linear?

Does "boire un jus" tend to mean "coffee" or "juice of fruit"?

Chandra exiles a card, I play it, it gets exiled again

Why isn't UDP with reliability (implemented at Application layer) a substitute of TCP?

What prevents a US state from colonizing a smaller state?

"in 60 seconds or less" or "in 60 seconds or fewer"?

What are the children of two Muggle-borns called?

Is it theoretically possible to hack printer using scanner tray?

A* pathfinding algorithm too slow

What is my external HDD doing?

Enterprise Layers and Naming Conventions

Time for some proverbs!

I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again

Why didn't Caesar move against Sextus Pompey immediately after Munda?

Why am I getting an electric shock from the water in my hot tub?

What's the lunar calendar of two moons

What was the first science fiction or fantasy multiple choice book?

How to count the number of bytes in a file, grouping the same bytes?

What is this fluorinated organic substance?

Why did the Apple IIe make a hideous noise if you inserted the disk upside down?



Wrong output from sentiment analysis?


How to flush output of print function?How to randomly select an item from a list?How do you read from stdin?Why is reading lines from stdin much slower in C++ than Python?How to remove a key from a Python dictionary?Adding scores of sentences depending on region Python very lostPython: How to total of the scores for all the tweets in a region divided by the number of tweets (Lots of info provided,)Completing a function to add Values depending on specific “Regions” (More info provided)The procedure to matching words from a list to words in a lineWhy am I getting a syntax error for my elif statement?













0















I'll explain my coding assignment in brief:



1)I have to calculate the happiness score of tweets from 4 different timezones.
There are two files, one contains the keywords each with an associated sentiment value and the other contains the actual tweets themselves.
2) I had to first read the keywords file and categorize the key words into 4 lists (based on their sentiment value). The tweets file is in the format [lat, long] value date time text.

3) The “happiness score” for a timezone is just the total of the scores (sentiment score) for all the tweets in that region divided by the number of tweets.
My program should ignore tweets with no keywords and also ignore tweets from
outside the time zones. So there may be some from outside the time zones.
Timezones



latitude,longitudelatitude,longitude



tweets file



keywords



keywordsfile=input("Enter name of keyword file: ")
infile=open(keywordsfile,"r",encoding="utf-8")
depressed=[] #keywords with sentiment value 1
okay=[] #keywords with sentiment value 5
good=[] #keywords with sentiment value 7
happy=[] #keywords with sentiment value 10
for line in infile:
line=line.rstrip()
keyWords=line.split(",")
keyWords[1]=int(keyWords[1])
if keyWords[1]==1:
depressed.append(keyWords[0])
elif keyWords[1]==5:
okay.append(keyWords[0])
elif keyWords[1]==7:
good.append(keyWords[0])
elif keyWords[1]==10:
happy.append(keyWords[0])
else:
pass
infile.close()
tweetfile=input("Enter name of tweet file: ")
infile2=open(tweetfile,"r",encoding="utf-8")
DEPRESSEDVALUE=1
OKAYVALUE=5
GOODVALUE=7
HAPPYVALUE=10
depressedKeys=0
okayKeys=0
goodKeys=0
happyKeys=0
numOfTweetsEastern=0
numOfTweetsCentral=0
numOfTweetsMountain=0
numOfTweetsPacific=0
for line in infile2:
line=line.rstrip()
words=line.split()
firststriplat=words[0].rstrip(",")
lat=firststriplat.lstrip("[")
lat=float(lat)
long=words[1].rstrip("]")
long=float(long)
easternLat= 24.660845 <= lat and lat<=49.189787
easternLong= -87.518395 <= long <= -67.444574
centralLat= 24.660845 <= lat and lat<=49.189787
centralLong= -101.998892 <= long <= -87.518395
mountainLat=24.660845 <= lat and lat<=49.189787
mountainLong=-115.236428 <= long <= -101.998892
pacificLat=24.660845 <= lat and lat<=49.189787
pacificLong= -125.242264<= long <= -115.236428
if easternLat and easternLong:
for word in words:
if word in depressed:
depressedKeys=depressedKeys+1
elif word in okay:
okayKeys=okayKeys+1
elif word in good:
goodKeys=goodKeys+1
elif word in happy:
happyKeys=happyKeys+1
else:
pass
numOfTweetsEastern=numOfTweetsEastern+1
sentimentValueEastern=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
elif centralLat and centralLong:
for word in words:
if word in depressed:
depressedKeys=depressedKeys+1
elif word in okay:
okayKeys=okayKeys+1
elif word in good:
goodKeys=goodKeys+1
elif word in happy:
happyKeys=happyKeys+1
else:
pass
numOfTweetsCentral=numOfTweetsCentral+1
sentimentValueCentral=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
elif mountainLat and mountainLong:
for word in words:
if word in depressed:
depressedKeys=depressedKeys+1
elif word in okay:
okayKeys=okayKeys+1
elif word in good:
goodKeys=goodKeys+1
elif word in happy:
happyKeys=happyKeys+1
else:
pass
numOfTweetsMountain=numOfTweetsMountain+1
sentimentValueMountain=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
elif pacificLat and pacificLong:
for word in words:
if word in depressed:
depressedKeys=depressedKeys+1
elif word in okay:
okayKeys=okayKeys+1
elif word in good:
goodKeys=goodKeys+1
elif word in happy:
happyKeys=happyKeys+1
else:
pass
numOfTweetsPacific=numOfTweetsPacific+1
sentimentValuePacific=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
else:
pass
happScoreEastern=sentimentValueEastern/numOfTweetsEastern
happScoreCentral=sentimentValueCentral/numOfTweetsCentral
happScoreMountain=sentimentValueMountain/numOfTweetsMountain
happScorePacific=sentimentValuePacific/numOfTweetsPacific
print("The happiness score for the Eastern timezone is",happScoreEastern,"and the total number of tweets were",numOfTweetsEastern)
print("The happiness score for the Central timezone is",happScoreCentral,"and the total number of tweets were",numOfTweetsCentral)
print("The happiness score for the Mountain timezone is",happScoreMountain,"and the total number of tweets were",numOfTweetsMountain)
print("The happiness score for the Pacific timezone is",happScorePacific,"and the total number of tweets were",numOfTweetsPacific)


However, apparently, my happiness scores and number of tweets from each time zone are way off (apparently way large numbers) Like way off. Where did I go wrong in my code? I thought I did everything right










share|improve this question


























    0















    I'll explain my coding assignment in brief:



    1)I have to calculate the happiness score of tweets from 4 different timezones.
    There are two files, one contains the keywords each with an associated sentiment value and the other contains the actual tweets themselves.
    2) I had to first read the keywords file and categorize the key words into 4 lists (based on their sentiment value). The tweets file is in the format [lat, long] value date time text.

    3) The “happiness score” for a timezone is just the total of the scores (sentiment score) for all the tweets in that region divided by the number of tweets.
    My program should ignore tweets with no keywords and also ignore tweets from
    outside the time zones. So there may be some from outside the time zones.
    Timezones



    latitude,longitudelatitude,longitude



    tweets file



    keywords



    keywordsfile=input("Enter name of keyword file: ")
    infile=open(keywordsfile,"r",encoding="utf-8")
    depressed=[] #keywords with sentiment value 1
    okay=[] #keywords with sentiment value 5
    good=[] #keywords with sentiment value 7
    happy=[] #keywords with sentiment value 10
    for line in infile:
    line=line.rstrip()
    keyWords=line.split(",")
    keyWords[1]=int(keyWords[1])
    if keyWords[1]==1:
    depressed.append(keyWords[0])
    elif keyWords[1]==5:
    okay.append(keyWords[0])
    elif keyWords[1]==7:
    good.append(keyWords[0])
    elif keyWords[1]==10:
    happy.append(keyWords[0])
    else:
    pass
    infile.close()
    tweetfile=input("Enter name of tweet file: ")
    infile2=open(tweetfile,"r",encoding="utf-8")
    DEPRESSEDVALUE=1
    OKAYVALUE=5
    GOODVALUE=7
    HAPPYVALUE=10
    depressedKeys=0
    okayKeys=0
    goodKeys=0
    happyKeys=0
    numOfTweetsEastern=0
    numOfTweetsCentral=0
    numOfTweetsMountain=0
    numOfTweetsPacific=0
    for line in infile2:
    line=line.rstrip()
    words=line.split()
    firststriplat=words[0].rstrip(",")
    lat=firststriplat.lstrip("[")
    lat=float(lat)
    long=words[1].rstrip("]")
    long=float(long)
    easternLat= 24.660845 <= lat and lat<=49.189787
    easternLong= -87.518395 <= long <= -67.444574
    centralLat= 24.660845 <= lat and lat<=49.189787
    centralLong= -101.998892 <= long <= -87.518395
    mountainLat=24.660845 <= lat and lat<=49.189787
    mountainLong=-115.236428 <= long <= -101.998892
    pacificLat=24.660845 <= lat and lat<=49.189787
    pacificLong= -125.242264<= long <= -115.236428
    if easternLat and easternLong:
    for word in words:
    if word in depressed:
    depressedKeys=depressedKeys+1
    elif word in okay:
    okayKeys=okayKeys+1
    elif word in good:
    goodKeys=goodKeys+1
    elif word in happy:
    happyKeys=happyKeys+1
    else:
    pass
    numOfTweetsEastern=numOfTweetsEastern+1
    sentimentValueEastern=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
    elif centralLat and centralLong:
    for word in words:
    if word in depressed:
    depressedKeys=depressedKeys+1
    elif word in okay:
    okayKeys=okayKeys+1
    elif word in good:
    goodKeys=goodKeys+1
    elif word in happy:
    happyKeys=happyKeys+1
    else:
    pass
    numOfTweetsCentral=numOfTweetsCentral+1
    sentimentValueCentral=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
    elif mountainLat and mountainLong:
    for word in words:
    if word in depressed:
    depressedKeys=depressedKeys+1
    elif word in okay:
    okayKeys=okayKeys+1
    elif word in good:
    goodKeys=goodKeys+1
    elif word in happy:
    happyKeys=happyKeys+1
    else:
    pass
    numOfTweetsMountain=numOfTweetsMountain+1
    sentimentValueMountain=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
    elif pacificLat and pacificLong:
    for word in words:
    if word in depressed:
    depressedKeys=depressedKeys+1
    elif word in okay:
    okayKeys=okayKeys+1
    elif word in good:
    goodKeys=goodKeys+1
    elif word in happy:
    happyKeys=happyKeys+1
    else:
    pass
    numOfTweetsPacific=numOfTweetsPacific+1
    sentimentValuePacific=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
    else:
    pass
    happScoreEastern=sentimentValueEastern/numOfTweetsEastern
    happScoreCentral=sentimentValueCentral/numOfTweetsCentral
    happScoreMountain=sentimentValueMountain/numOfTweetsMountain
    happScorePacific=sentimentValuePacific/numOfTweetsPacific
    print("The happiness score for the Eastern timezone is",happScoreEastern,"and the total number of tweets were",numOfTweetsEastern)
    print("The happiness score for the Central timezone is",happScoreCentral,"and the total number of tweets were",numOfTweetsCentral)
    print("The happiness score for the Mountain timezone is",happScoreMountain,"and the total number of tweets were",numOfTweetsMountain)
    print("The happiness score for the Pacific timezone is",happScorePacific,"and the total number of tweets were",numOfTweetsPacific)


    However, apparently, my happiness scores and number of tweets from each time zone are way off (apparently way large numbers) Like way off. Where did I go wrong in my code? I thought I did everything right










    share|improve this question
























      0












      0








      0








      I'll explain my coding assignment in brief:



      1)I have to calculate the happiness score of tweets from 4 different timezones.
      There are two files, one contains the keywords each with an associated sentiment value and the other contains the actual tweets themselves.
      2) I had to first read the keywords file and categorize the key words into 4 lists (based on their sentiment value). The tweets file is in the format [lat, long] value date time text.

      3) The “happiness score” for a timezone is just the total of the scores (sentiment score) for all the tweets in that region divided by the number of tweets.
      My program should ignore tweets with no keywords and also ignore tweets from
      outside the time zones. So there may be some from outside the time zones.
      Timezones



      latitude,longitudelatitude,longitude



      tweets file



      keywords



      keywordsfile=input("Enter name of keyword file: ")
      infile=open(keywordsfile,"r",encoding="utf-8")
      depressed=[] #keywords with sentiment value 1
      okay=[] #keywords with sentiment value 5
      good=[] #keywords with sentiment value 7
      happy=[] #keywords with sentiment value 10
      for line in infile:
      line=line.rstrip()
      keyWords=line.split(",")
      keyWords[1]=int(keyWords[1])
      if keyWords[1]==1:
      depressed.append(keyWords[0])
      elif keyWords[1]==5:
      okay.append(keyWords[0])
      elif keyWords[1]==7:
      good.append(keyWords[0])
      elif keyWords[1]==10:
      happy.append(keyWords[0])
      else:
      pass
      infile.close()
      tweetfile=input("Enter name of tweet file: ")
      infile2=open(tweetfile,"r",encoding="utf-8")
      DEPRESSEDVALUE=1
      OKAYVALUE=5
      GOODVALUE=7
      HAPPYVALUE=10
      depressedKeys=0
      okayKeys=0
      goodKeys=0
      happyKeys=0
      numOfTweetsEastern=0
      numOfTweetsCentral=0
      numOfTweetsMountain=0
      numOfTweetsPacific=0
      for line in infile2:
      line=line.rstrip()
      words=line.split()
      firststriplat=words[0].rstrip(",")
      lat=firststriplat.lstrip("[")
      lat=float(lat)
      long=words[1].rstrip("]")
      long=float(long)
      easternLat= 24.660845 <= lat and lat<=49.189787
      easternLong= -87.518395 <= long <= -67.444574
      centralLat= 24.660845 <= lat and lat<=49.189787
      centralLong= -101.998892 <= long <= -87.518395
      mountainLat=24.660845 <= lat and lat<=49.189787
      mountainLong=-115.236428 <= long <= -101.998892
      pacificLat=24.660845 <= lat and lat<=49.189787
      pacificLong= -125.242264<= long <= -115.236428
      if easternLat and easternLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsEastern=numOfTweetsEastern+1
      sentimentValueEastern=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      elif centralLat and centralLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsCentral=numOfTweetsCentral+1
      sentimentValueCentral=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      elif mountainLat and mountainLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsMountain=numOfTweetsMountain+1
      sentimentValueMountain=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      elif pacificLat and pacificLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsPacific=numOfTweetsPacific+1
      sentimentValuePacific=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      else:
      pass
      happScoreEastern=sentimentValueEastern/numOfTweetsEastern
      happScoreCentral=sentimentValueCentral/numOfTweetsCentral
      happScoreMountain=sentimentValueMountain/numOfTweetsMountain
      happScorePacific=sentimentValuePacific/numOfTweetsPacific
      print("The happiness score for the Eastern timezone is",happScoreEastern,"and the total number of tweets were",numOfTweetsEastern)
      print("The happiness score for the Central timezone is",happScoreCentral,"and the total number of tweets were",numOfTweetsCentral)
      print("The happiness score for the Mountain timezone is",happScoreMountain,"and the total number of tweets were",numOfTweetsMountain)
      print("The happiness score for the Pacific timezone is",happScorePacific,"and the total number of tweets were",numOfTweetsPacific)


      However, apparently, my happiness scores and number of tweets from each time zone are way off (apparently way large numbers) Like way off. Where did I go wrong in my code? I thought I did everything right










      share|improve this question














      I'll explain my coding assignment in brief:



      1)I have to calculate the happiness score of tweets from 4 different timezones.
      There are two files, one contains the keywords each with an associated sentiment value and the other contains the actual tweets themselves.
      2) I had to first read the keywords file and categorize the key words into 4 lists (based on their sentiment value). The tweets file is in the format [lat, long] value date time text.

      3) The “happiness score” for a timezone is just the total of the scores (sentiment score) for all the tweets in that region divided by the number of tweets.
      My program should ignore tweets with no keywords and also ignore tweets from
      outside the time zones. So there may be some from outside the time zones.
      Timezones



      latitude,longitudelatitude,longitude



      tweets file



      keywords



      keywordsfile=input("Enter name of keyword file: ")
      infile=open(keywordsfile,"r",encoding="utf-8")
      depressed=[] #keywords with sentiment value 1
      okay=[] #keywords with sentiment value 5
      good=[] #keywords with sentiment value 7
      happy=[] #keywords with sentiment value 10
      for line in infile:
      line=line.rstrip()
      keyWords=line.split(",")
      keyWords[1]=int(keyWords[1])
      if keyWords[1]==1:
      depressed.append(keyWords[0])
      elif keyWords[1]==5:
      okay.append(keyWords[0])
      elif keyWords[1]==7:
      good.append(keyWords[0])
      elif keyWords[1]==10:
      happy.append(keyWords[0])
      else:
      pass
      infile.close()
      tweetfile=input("Enter name of tweet file: ")
      infile2=open(tweetfile,"r",encoding="utf-8")
      DEPRESSEDVALUE=1
      OKAYVALUE=5
      GOODVALUE=7
      HAPPYVALUE=10
      depressedKeys=0
      okayKeys=0
      goodKeys=0
      happyKeys=0
      numOfTweetsEastern=0
      numOfTweetsCentral=0
      numOfTweetsMountain=0
      numOfTweetsPacific=0
      for line in infile2:
      line=line.rstrip()
      words=line.split()
      firststriplat=words[0].rstrip(",")
      lat=firststriplat.lstrip("[")
      lat=float(lat)
      long=words[1].rstrip("]")
      long=float(long)
      easternLat= 24.660845 <= lat and lat<=49.189787
      easternLong= -87.518395 <= long <= -67.444574
      centralLat= 24.660845 <= lat and lat<=49.189787
      centralLong= -101.998892 <= long <= -87.518395
      mountainLat=24.660845 <= lat and lat<=49.189787
      mountainLong=-115.236428 <= long <= -101.998892
      pacificLat=24.660845 <= lat and lat<=49.189787
      pacificLong= -125.242264<= long <= -115.236428
      if easternLat and easternLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsEastern=numOfTweetsEastern+1
      sentimentValueEastern=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      elif centralLat and centralLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsCentral=numOfTweetsCentral+1
      sentimentValueCentral=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      elif mountainLat and mountainLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsMountain=numOfTweetsMountain+1
      sentimentValueMountain=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      elif pacificLat and pacificLong:
      for word in words:
      if word in depressed:
      depressedKeys=depressedKeys+1
      elif word in okay:
      okayKeys=okayKeys+1
      elif word in good:
      goodKeys=goodKeys+1
      elif word in happy:
      happyKeys=happyKeys+1
      else:
      pass
      numOfTweetsPacific=numOfTweetsPacific+1
      sentimentValuePacific=(depressedKeys*DEPRESSEDVALUE)+(okayKeys*OKAYVALUE)+(goodKeys*GOODVALUE)+(happyKeys*HAPPYVALUE)
      else:
      pass
      happScoreEastern=sentimentValueEastern/numOfTweetsEastern
      happScoreCentral=sentimentValueCentral/numOfTweetsCentral
      happScoreMountain=sentimentValueMountain/numOfTweetsMountain
      happScorePacific=sentimentValuePacific/numOfTweetsPacific
      print("The happiness score for the Eastern timezone is",happScoreEastern,"and the total number of tweets were",numOfTweetsEastern)
      print("The happiness score for the Central timezone is",happScoreCentral,"and the total number of tweets were",numOfTweetsCentral)
      print("The happiness score for the Mountain timezone is",happScoreMountain,"and the total number of tweets were",numOfTweetsMountain)
      print("The happiness score for the Pacific timezone is",happScorePacific,"and the total number of tweets were",numOfTweetsPacific)


      However, apparently, my happiness scores and number of tweets from each time zone are way off (apparently way large numbers) Like way off. Where did I go wrong in my code? I thought I did everything right







      python sentiment-analysis tweets






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 16:35









      Amandeep PasrichaAmandeep Pasricha

      197 bronze badges




      197 bronze badges




















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342503%2fwrong-output-from-sentiment-analysis%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342503%2fwrong-output-from-sentiment-analysis%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript