'Rel. Shares',
'Rel. Comments']
musicians = pd.DataFrame(columns=columns)
Here we’ve outlined the columns of interest to us. As we loop over the posts in each
musician’s feed, we’ll get a measure of each post’s likes, shares, and comments, as well
as the relative measures of each (i.e., the fraction of the artist’s total number of fans
that reacted). How to do this is shown in Example 2-9.
Example 2-9. Storing data in a pandas DataFrame
# Build the DataFrame by adding the last 10 posts and their audience
# reaction measures for each of the artists
for page_id in [taylor_swift_id, drake_id, beyonce_id]:
name = g.get_object(id=page_id)['name'] ...