AI

Mapping out the connections of Oscar Winners | by Milan Janosov | Feb, 2024

[ad_1]

On this quick piece, I take advantage of public Wikipedia knowledge, Python programming, and community evaluation to extract and draw up a community of Oscar-winning actors and actresses.

All pictures have been created by the creator.

Wikipedia, as the biggest free, crowdsourced on-line encyclopedia, serves as a tremendously wealthy knowledge supply on varied public domains. Many of those domains, from movie to politics, contain varied layers of networks beneath, expressing differing types of social phenomena similar to collaboration. Because of the approaching Academy Awards Ceremony, right here I present the instance of Oscar-winning actors and actresses on how we are able to use easy Pythonic strategies to show Wiki websites into networks.

First, let’s check out how, as an illustration, the Wiki list of all Oscar-winning actors is structured:

Wiki list of all Oscar-winning actors

This subpage properly exhibits all of the individuals who have ever acquired an Oscar and have been granted a Wiki profile (almost certainly, no actors and actresses have been missed by the followers). On this article, I concentrate on performing, which may be discovered within the following 4 subpages — together with primary and supporting actors and actresses:

urls = { 'actor'         :'https://en.wikipedia.org/wiki/Class:Best_Actor_Academy_Award_winners',
'actress' : 'https://en.wikipedia.org/wiki/Class:Best_Actress_Academy_Award_winners',
'supporting_actor' : 'https://en.wikipedia.org/wiki/Class:Best_Supporting_Actor_Academy_Award_winners',
'supporting_actress' : 'https://en.wikipedia.org/wiki/Class:Best_Supporting_Actress_Academy_Award_winners'}

Now let’s write a easy block of code that checks every of those 4 listings, and utilizing the packages urllib and beautifulsoup, extracts the identify of all artists:

from urllib.request import urlopen
import bs4 as bs
import re

# Iterate throughout the 4 classes
people_data = []

for class, url in urls.objects():

# Question the identify itemizing web page and…

[ad_2]

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button