Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [datetime.datetime(2009, 4, 15, 21, 58, 14), 0]
- with open('newdata.txt') as f:
- for line in f:
- tweet=re.sub(r'Tt',"",line)
- t=re.sub(r'Wt',"//",tweet)
- data=t.split("//")
- sentiment_value= s.sentiment(data[1])
- data.append(sentiment_value)
- words = [w.replace('pos', '1') for w in data]
- word=[w.replace('neg','0')for w in words]
- del word[1]
- word[1]=int(word[1])
- word[0]=datetime.strptime(word[0],'%Y-%m-%d %H:%M:%S ')
- print(word)
- values= (word)
- ax = plt.subplot(111)
- ax.plot_date([value[0] for value in values], [value[1] for value in values], "-o")
- plt.show()
- TypeError: 'datetime.datetime' object is not subscriptable
- word[0]=matplotlib.dates.date2num(word[0])
- TypeError: 'float' object is not subscriptable
Add Comment
Please, Sign In to add comment