Issues with extracting location information #1448
-
Hi all, I'm using the tweet.place command to get the geolocation information of a tweet but having issues parsing the value that I get (included below) to extract 'full_name' and 'coordinates' and save them in their respective columns in csv. Place(_api=<tweepy.api.API object at 0x7fed42e02f40>, id='36b9518ae4e9e210', url='https://api.twitter.com/1.1/geo/id/36b9518ae4e9e210.json', place_type='city', name='Pharr', full_name='Pharr, TX', country_code='US', country='United States', contained_within=[], bounding_box=BoundingBox(_api=<tweepy.api.API object at 0x7fed42e02f40>, type='Polygon', coordinates=[[[-98.220006, 26.085485], [-98.15929, 26.085485], [-98.15929, 26.2503244], [-98.220006, 26.2503244]]]), attributes={}) Does anyone have a solution? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Have you tried using the dot notation to access them? |
Beta Was this translation helpful? Give feedback.
-
A Place object's fields are exposed as attributes of the object in Tweepy, e.g. |
Beta Was this translation helpful? Give feedback.
A Place object's fields are exposed as attributes of the object in Tweepy, e.g.
tweet.place.full_name
.The same applies to
BoundingBox
objects, e.g.tweet.place.bounding_box.coordinates
.