Oct-09-2017, 08:59 AM
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
in the example you refer to, data_all is list of dicts
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