[TUTORIAL] Which generation controls the Philippine Senate? #DataViz.

Fork this project in Github here
Get the data in Kaggle here


Earlier this year, I saw this post in r/dataisbeautiful showing the representation of generations in the US Senate. After seeing it, I just knew I had to make one for our Senate.

Here is the completed visualization. Each tile represents a Philippine Senator. I based the design from the original post, but the major innovation I made is that I added hover interactions using the python library Bokeh.

I invite you to hover on the tiles and check out whats written on them!



Looks neat, doesnt it?

What can we say about the chart?#

Here are some of the insights from the chart and dataset:

  • The Senate in the present Congress (Eighteenth) is run by equal numbers of Generation X and Baby Boomers.

  • The median age of a Philippine Senator is 55 years.

  • The youngest Senate batch so far (median age of 49 years) was elected during the Seventeenth Congress(2016), while the oldest batch (median age of 59.5 years) was elected during the Eleventh Congress (1998)

  • The most generation-monopolized senate batch was elected during the Sixth Congress, with 29/32 positions filled by Greatest Generation senators.

  • On the other hand, Thirteenth (2004) to Sixteenth (2013) Congress has the most diverse generation mix with 4 generations represented (with Sen. Juan Ponce Enrile bringing his own lone generation in the mix)

  • The first Silent generation to be elected was Sen. Benigno “Ninoy” Aquino, Jr. (34 years old) in the Sixth Congress (1966), while the first Baby Boomer to be elected is Sen. Jose Lina (36 years old) in the Eight Congress (1987)

  • ALL Senate batches had at least one septuagenarian (someone in their 70s) colleague, EXCEPT during the Eight Congress (1987) when the oldest senator was Sen. Raul Maglapus at 69 years old.

  • The youngest elected Senators are Sen. Bam Aquino III and Sen. Antonio Trillanes IV at 36 years old at the year of Fourteenth (2007) and Sixteenth Congress (2013) respectively. If we’re talking about months, then Sen. Bam Aquino III holds the youngest elected senator, being 3 months younger than the latter at time of their election.

  • But they were not the first of his generation to be elected: Sen. Pia Cayetano and Sen. Bong Revilla (both 38 years old) were the first Generation X to be elected during the Thirteenth congress (2004).

  • The oldest elected senator is Sen. Juan Ponce Enrile during the Sixteenth Congress (2013) at 89 years old.

  • We still have yet to elect a millenial Senator. To compare, U.S. already had its first millenial Senator (Sen Jon Ossoff, 33 years old) during its 2020 elections.

From the charts, it seems like the first senator from a new generation is elected every 20 years.

The BIG QUESTION is—will we see our first elected millenial senator in 2022?



On the coding side of things, I think this viz is easy to make and will be great for those of you who want to start learning how to make interactive charts in python.

But first—how were the generations defined?#

There are many ways to name generations (I’m no sociologist, so I’d defer to the sociologists reading this blog to assess if I made the right choice). For this visualization, I chose to use the Strauss-Howe definition of generations.

These two folks, Neil Howe and William Strauss, defined generational cohorts in the U.S. as follows:

  • 2000 to present : Generation Z (or New Silent Generation)
  • 1980 to 2000: Millennials (or Generation Y)
  • 1965 to 1979: Generation X
  • 1946 to 1964: Baby Boomers
  • 1925 to 1945: the Silent Generation
  • 1900 to 1924: the Greatest (or G.I.) Generation
  • 1883 to 1900: Lost Generation
  • 1860 to 1882: Missionary Generation

However, I introduced a change in the classification and renamed the Missionary Generation as

  • 1860 to 1882: Revolutionary Generation

since I didnt feel that the missionary keyword (about US expansion to the west coast) applied well in our country’s context. I renamed it as “Revolutionary generation” because it was at this time when our ancestors started brewing their resistance against Sapnish rule, with notable events like the GomBurZa executions(1872). This is highly contentious so let me know if you agree or disagree with this. Suggestions are always welcome!

Where did the data come from?#

There wasnt any machine-readable format of PH Senator profiles (full names, birthday and birthplace) when I checked the Web, so to be able to create the viz, I had to manually encode the data in the legacy page of the official Philippine Senate Website from the First Congress(1946) up to present.

Whenever a detail is not present/seemingly erroneous in the profiles at the website, I sourced and cross-referenced the detail from the senators’ official or wiki pages, and news articles.

All in all I have scraped 458 senator profiles. It took me around 6 hours spread in 3 days to finish encoding the dataset.

You may download the dataset from Kaggle. Please message me if you find any inconsistencies in the data.

What are the tools I used?#

I used pandas to read and analyze the dataset, matplotlib to make some basic plots, and the categorical heat map in bokeh to make the final interactive chart.

I invite you to look at and try out the jupyter notebook in this Github repo



Thats it—hope you found this plot useful and insightful! Enjoy coding!