← All datasets

World Leaders

Every head of state and head of government since 1900, one row per STINT in power: 6,299 stints across 199 countries and 4,734 leaders. The first CodeSights dataset built on Wikidata's SPARQL endpoint rather than article scraping, because this data lives there as a queryable graph: each country's canonical offices, every officeholder statement with typed start and end dates, and the biography behind each name. Stints carry days and years in power (incumbents flagged and measured to the pull date), stint numbers so non-consecutive returns stay separate (Trump's second term is stint 2 of 2), how the term ended where recorded, and Died_In_Office verified against the death date (397 did). Each leader carries birth and death dates, ages taking and leaving office and at death, gender, birthplace, party, education, occupations, spouse count and children count from Wikidata's own statements, plus their English Wikipedia article (94% linked). The pipeline fights real Wikidata noise honestly: reversed date pairs dropped, duplicate statements collapsed, placeholder birth dates rejected by an age guard that still admits real infant monarchs (Sobhuza II, crowned at four months, reigned 82.7 years, both the youngest start and the longest run in the data), and offices held by a collegial body rather than a person reported instead of silently absent. Median age taking office is 54; the median stint lasts just 1.7 years; 258 stints belong to women. Built with a 16-test acceptance suite anchored on FDR's 4,422 days, Merkel's 16.0 years and Elizabeth II's 70.6.
6,299 rows 1 file last pulled 2026-09-11
World Leaders 6,299 rows × 26 columns
LeaderCountryPositionRoleTook_OfficeLeft_OfficeIncumbentDays_In_PowerYears_In_PowerStint_NumberTotal_StintsHow_It_EndedDied_In_OfficeGenderBirth_DateDeath_DateAge_at_DeathAge_Taking_OfficeAge_Leaving_OfficeBirth_PlaceSpouses_CountChildren_CountPartyEducationOccupationsLeader_URL

Questions and answers

What is the World Leaders dataset?

Every head of state and head of government since 1900, one row per STINT in power: 6,299 stints across 199 countries and 4,734 leaders. The first CodeSights dataset built on Wikidata's SPARQL endpoint rather than article scraping, because this data lives there as a queryable graph: each country's canonical offices, every officeholder statement with typed start and end dates, and the biography behind each name. Stints carry days and years in power (incumbents flagged and measured to the pull date), stint numbers so non-consecutive returns stay separate (Trump's second term is stint 2 of 2), how the term ended where recorded, and Died_In_Office verified against the death date (397 did). Each leader carries birth and death dates, ages taking and leaving office and at death, gender, birthplace, party, education, occupations, spouse count and children count from Wikidata's own statements, plus their English Wikipedia article (94% linked). The pipeline fights real Wikidata noise honestly: reversed date pairs dropped, duplicate statements collapsed, placeholder birth dates rejected by an age guard that still admits real infant monarchs (Sobhuza II, crowned at four months, reigned 82.7 years, both the youngest start and the longest run in the data), and offices held by a collegial body rather than a person reported instead of silently absent. Median age taking office is 54; the median stint lasts just 1.7 years; 258 stints belong to women. Built with a 16-test acceptance suite anchored on FDR's 4,422 days, Merkel's 16.0 years and Elizabeth II's 70.6.

How big is the World Leaders dataset?

6,299 rows in one CSV file, with 26 columns in total: Leader, Country, Position, Role, Took_Office, Left_Office, Incumbent, Days_In_Power, Years_In_Power, Stint_Number, Total_Stints, How_It_Ended, Died_In_Office, Gender, Birth_Date, Death_Date, Age_at_Death, Age_Taking_Office, Age_Leaving_Office, Birth_Place, Spouses_Count, Children_Count, Party, Education, Occupations, Leader_URL.

Where does the data come from?

It is built by programmatically scraping wikidata.org, last pulled on 2026-09-11. Datasets are versioned; older versions stay downloadable.

Is the dataset free to download?

Yes. Every CodeSights dataset is completely free as a CSV download; a free account is all it takes. Anyone can preview the data without signing in.

Can I see the code that built this dataset?

Yes. The exact Python scraper that built it is viewable on the dataset page by any signed-in member, so every number is reproducible.

Can the data contain errors?

Automated scraping leaves room for error and the underlying sources change over time, so no version is guaranteed accurate or complete. If a number matters, verify it against the original source.

Browse every free dataset on CodeSights