Python: Population Projections by County and by City for Japan, google sheets ver. 15

Last Updated on July 18, 2022 by shibatau

The errors of the codes are corrected.

A Chart of Over 64 for all prefectures are added.

I. Data

You can get the data for Japan’s population projections here:

『日本の地域別将来推計人口』(平成30(2018)年推計)

The survey seems to be conducted every 5 years and the 2018 version is the latest.

You have to upload the four files, kekkahyo1.xls, kekkahyo2_1.xls, kekkahyo2_2.xls, and kekkahyo2_3.xls before running the scripts on Google Colaboratory. You can find all the links to these files on the page linked above.

II. Making a tidy data table

You can learn what a tidy data table is from here:

Tidy data

The tutorial begins with the following fascinating quotations:

“Happy families are all alike; every unhappy family is unhappy in its own way.” –– Leo Tolstoy

“Tidy datasets are all alike, but every messy dataset is messy in its own way.” –– Hadley Wickham

Let’s make the tables tidy:

III. Creating charts

You can create an area charts with pattern fills if you have installed plotly 5.7 or 5.8

You can create a multiple line chart for all the cities in a prefecture:

You can also create a multiple line chart for all the prefectures in Japan:

IV. Scripts

Please put down the names of the city and prefecture that you are interested in and run the scripts here:

https://colab.research.google.com/drive/1SHoknq5fIPr_PB8n9ta2FSrCiPhehMvx?usp=sharing

V. Creating charts with Google Sheets

You can create charts using Google Sheets. You can also add a column of the names translated with GOOGLETRANSLATE( ) like this.

You can see a sample sheet here:

https://docs.google.com/spreadsheets/d/150qOhV_4mclXDWai9U6B2x4EkLmyCCWi/edit?usp=sharing&ouid=103442806177006309190&rtpof=true&sd=true

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.