ptwobrussell / Mining-the-Social-Web-2nd-Edition

The official online compendium for Mining the Social Web, 2nd Edition (O'Reilly, 2013)
http://bit.ly/135dHfs
Other
2.9k stars 1.49k forks source link

KeyError: 'likes' in example 2-5 #334

Open datomnurdin opened 6 years ago

datomnurdin commented 6 years ago

I got this error message

Pepsi likes:
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-13-958828f64553> in <module>()
     12 def int_format(n): return "{:,}".format(n)
     13 
---> 14 print "Pepsi likes:", int_format(g.get_object(pepsi_id)['likes'])
     15 print "Coke likes:", int_format(g.get_object(coke_id)['likes'])

KeyError: 'likes'

for this code

print "Pepsi likes:", int_format(g.get_object(pepsi_id)['likes'])

Please advice. Thank you.