Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help :)
#8
why the b - again, it depends how you populate the dflist - and that is what I ask all the time so far. b designates it as binary string.
as to the other problem - at the moment your dflist is a list of strings, so you need to loop over it like this

dflist = [b'xfer nb -5099 - kindly cb cust,tq......Wan,pls assist..------..RENEW WITH POS MALAYSIA', b'Miss Chia query how to make a online payment, adv used M2U online and select Etiqa - Life Ins', b'enq for quotation for renewal....pls cb cust..---------..kakej assist (DONE)', b'Cust looking huda....xfer nb-5010-huda.']
for tweet_txt in dflist:
    call.append(tweet_txt)
    vs_compound.append(analyzer.polarity_scores(tweet_txt)['compound'])
    vs_pos.append(analyzer.polarity_scores(tweet_txt)['pos'])
    vs_neu.append(analyzer.polarity_scores(tweet_txt)['neu'])
    vs_neg.append(analyzer.polarity_scores(tweet_txt)['neg'])
if analyzer does not work with binary strings, you can change the way you populate dflist, or convert the elements to strings like this

 dflist = [txt.decode('utf-8') for txt in dflist]

in the example you refer to, data_all is list of dicts
Reply


Messages In This Thread
Please help :) - by crystalteoh92 - Oct-09-2017, 03:54 AM
RE: Please help :) - by buran - Oct-09-2017, 06:31 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 07:06 AM
RE: Please help :) - by buran - Oct-09-2017, 07:13 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 08:13 AM
RE: Please help :) - by buran - Oct-09-2017, 08:23 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 08:43 AM
RE: Please help :) - by buran - Oct-09-2017, 08:59 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 09:20 AM
RE: Please help :) - by buran - Oct-09-2017, 10:10 AM
RE: Please help :) - by snippsat - Oct-09-2017, 11:49 AM
RE: Please help :) - by buran - Oct-09-2017, 02:00 PM
RE: Please help :) - by crystalteoh92 - Oct-10-2017, 01:04 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020