[PYTHON] Differences in prices by prefecture (2019)

Even within the same Japan, prices seem to differ depending on the region. Let's visualize it.

Statistical data

The statistical data used this time is as follows.

-Statistics Bureau, Ministry of Internal Affairs and Communications, Retail Price Statistics Survey (Structure) -10 Consumer Price Index by Large Expenses (National Average = 100) -National, Local, Prefectural, Prefectural Offices and Ordinance-designated Cities / stat-search / files? page = 1 & layout = datalist & lid = 000001248538 & toukei = 00200571 & tstat = 000001067253 & cycle = 7 & year = 20190 & month = 0 & stat_infid = 000031953650)

If you follow the linked page, you can also download the statistical data in CSV format. It's good to have the impression that e-Stat is improving in ease of use year by year.

Consumer Price Index by 10 Major Expenses

The 10 major expenses are 1. Food, 2. Housing, 3. Light and water, 4. Furniture and household items, 5. Clothing and footwear, 6. Health insurance, 7. Transportation and communication, 8. Education, 9 It is said that it is the classification of culture and entertainment, 10. miscellaneous expenses. In addition, there are items of "general" and "general excluding rent", which are the sum of those expenses. You can check the list of aggregated items from here.

Data preparation

Data can be downloaded from the Statistical Table / Graph Display page of e-Stat. After that, format the data with Excel etc. and export it in CSV format as shown below.

price_index_by_prefecture_2019.csv


Prefectures,Comprehensive,food,Residence,Light and hot water,Furniture Household goods,Clothing and footwear,Health care,Transportation communication,education,Liberal arts and entertainment,Miscellaneous expenses,家賃を除くComprehensive
Hokkaido,99.9,100.1,84.1,116.4,98.2,104.6,100.4,100.1,93.5,97.6,99.2,100.9
Aomori Prefecture,98.4,98,86,109.1,97.7,102.3,99.1,100.5,93.5,95.2,98.1,99.3
Iwate Prefecture,99.1,97.4,93.1,110.1,101.1,97.4,100.1,99.2,90,100.5,98.6,99.4
Miyagi Prefecture,99.3,97.9,101.8,101.9,104.9,95.9,100.9,98,102.3,99.5,99.8,99.4
Akita,98.4,97.6,86.2,107.8,101.7,100.2,99.2,98.6,88.9,98.6,100.4,98.9
Yamagata Prefecture,100.2,101.4,90.7,111.4,94.6,98.4,97,99.9,104.7,98.5,97.6,100.7
Fukushima Prefecture,99.6,99.5,96,108.8,102.3,104.2,99.7,98.5,91.8,94.8,101.4,100.1
Ibaraki Prefecture,98.1,99,97.6,102.9,96.1,99.4,98.3,96.8,89.8,96.3,100.9,98.4
Tochigi Prefecture,98.2,98.6,85.7,98.7,101.6,112.5,100.1,97.7,99.8,96.1,99.5,98.7
Gunma Prefecture,96.6,98.9,85.2,91.5,97.4,103.1,100.8,97.9,85.4,96.7,98.2,97.2
Saitama,101,100.5,104.8,94.4,102.7,103.8,100.6,100.8,98.8,104.3,101.3,100.4
Chiba,100.7,101.2,104,101.8,100.9,96.1,100,99,97.8,102.7,99.6,100.6
Tokyo,104.7,103.4,132.3,95.5,103.8,100.1,101.5,104.8,106.7,104.1,100.2,103
Kanagawa Prefecture,104,101.7,125.1,98.4,100.2,102.1,101.5,103.2,111.9,105.2,102.6,103.2
Niigata Prefecture,98.7,100,91.6,99.1,97.1,101,99.5,98.3,93.8,99.1,100.5,98.8
Toyama Prefecture,98.6,101.5,89.3,100.4,98.5,103.1,101.9,97.7,87.4,95.1,101.4,99.1
Ishikawa Prefecture,100.2,103.6,86.3,101.8,100.4,103.2,100.6,98.6,103.5,97.4,100.8,100.7
Fukui prefecture,99.3,103.8,85.4,94.5,102.3,101,100.4,99,106.9,94,101.3,99.8
Yamanashi Prefecture,98.7,100.6,93,96.4,99.3,102.4,99.3,99.1,89.9,98.3,99.1,99.2
Nagano Prefecture,97.7,95.2,90.4,102,101.3,104.4,98.2,100.1,88,98.5,101.5,98.2
Gifu Prefecture,97.3,98.1,85.2,93.7,94,104.2,99.3,100.2,92.5,98.2,100.2,97.9
Shizuoka Prefecture,98.5,98.9,99.9,98,100.1,98.8,99.8,99,86,99.3,98.1,98.7
Aichi prefecture,97.6,97.2,95.2,95.9,96.6,95.5,99.9,97.7,98.2,99.8,99.1,97.7
Mie Prefecture,98.7,100.6,92.9,99,98.5,98.5,99.2,99,99.8,95.5,99.6,99.3
Shiga Prefecture,99.5,99.8,89.5,99,98.4,103.1,100.6,100.4,109.1,97.4,102.3,100
Kyoto,100.6,100.8,94.5,97.7,100.9,98.9,97.9,102.5,115.6,100.5,100.5,100.8
Osaka,99.7,99.9,97.1,94.7,99.9,96.4,99,100.6,109.2,102.5,97.7,99.7
Hyogo prefecture,100.3,99.5,99.4,96.4,101.9,104,98.4,100.7,105.5,100.4,102.4,100.3
Nara Prefecture,97.5,96.7,87.1,98.4,99.3,100.1,99.1,99.7,94.2,99.1,100.1,97.8
Wakayama Prefecture,99.2,100.7,90.3,98.4,95.9,102.2,101.4,100.1,108.6,95.4,99.9,99.9
Tottori prefecture,98.6,101.7,81.7,106.2,100.8,106.9,99.4,97.1,91.3,93.9,98.8,99.2
Shimane Prefecture,99.5,101.5,87,111,98.4,95.1,99.8,99.6,96.6,96.9,99.7,100
Okayama Prefecture,97.6,98.7,87.1,106.2,99.6,99.6,100.6,96.5,84.4,96.7,99.9,98.1
Hiroshima Prefecture,99,100.4,90.4,105.7,96.6,96.5,99.8,99.4,99.6,95.6,100.4,99.3
Yamaguchi Prefecture,98.7,100.8,87.9,108.5,96,102.8,101.6,97.4,86.5,95.7,100.4,99.5
Tokushima Prefecture,100.1,100.9,96.5,104.5,103,110,98.2,97.6,96.1,97.5,100.5,100.6
Kagawa Prefecture,98.3,99.5,85.5,105.5,101.9,92.4,99.5,99.8,93.4,94.9,103.5,99.2
Ehime Prefecture,97.9,99.5,82.4,106.8,100.8,98.4,99.5,97.6,94.1,97.7,97.6,98.7
Kochi Prefecture,99.8,102.4,93.6,103.6,99.5,100.4,100.7,98.9,92.4,96.6,101.1,100.5
Fukuoka Prefecture,96.8,95.8,84.6,104.2,98.7,94,98.8,98.8,96.2,97.6,100.7,97.7
Saga Prefecture,97.5,98.1,83.6,109.2,97.4,104.6,100.2,98.6,94.5,92.6,98.1,98.5
Nagasaki Prefecture,99.8,98.9,93.4,109.5,103.6,108.5,100,100.1,90.5,96.3,99.9,99.9
Kumamoto Prefecture,98.8,100.5,89.7,101.2,97.3,100.9,101.4,99.5,93.2,96.1,100.3,99.6
Oita Prefecture,97.7,98.8,84.8,103.7,99.3,94.7,96.9,98.4,105.4,96,98.1,98.8
Miyazaki prefecture,96,96.5,85.1,100.5,102.1,94.7,99,98.4,90.7,91.9,97.3,97
Kagoshima prefecture,96.3,98.9,85.2,99.3,97.5,90.6,99.3,99.4,92.9,91.8,94.4,97
Okinawa Prefecture,98.4,103.2,85.6,103.8,96.1,98.9,98.5,97.8,93.4,97.9,94.8,99.8

Environmental preparation

Prepare the environment for visualization.

Launch Jupyter Notebook

This time, we will visualize it with Jupyter Notebook. In the Windows environment, you can install and start Jupyter Notebook with the following command (Official Document).

> pip install jupyter #Jupyter installation
> python -m notebook #Launch Jupyter Notebook

Once started, you can use the Jupyter Notebook environment by accessing http: // localhost: 8888 with a web browser.

script

This time, we will use the japanmap library to display colors by prefecture. The script below is an example of visualizing the data in the "Comprehensive" column.

import pandas as pd
import matplotlib.pyplot as plt
from japanmap import picture

df = pd.read_csv('price_index_by_prefecture_2019.csv') #Read data file
df = df.set_index('Prefectures') #Specify index

cmap = plt.get_cmap('Reds') #Color settings
norm = plt.Normalize(vmin=df.Comprehensive.min(), vmax=df.Comprehensive.max()) #Set color range
fcol = lambda x: '#' + bytes(cmap(norm(x), bytes=True)[:3]).hex() #Set color code

plt.title('2019 10 Consumer Price Index by Large Expenses(National average=100) -Comprehensive',fontname="Yu Gothic") #title
plt.rcParams['figure.figsize'] = 12, 12 #Figure size
plt.colorbar(plt.cm.ScalarMappable(norm, cmap)) #Color scale display
plt.imshow(picture(df.Comprehensive.apply(fcol))); #graph display
plt.savefig('pricemap2019_general.png') #Export to image file

Visualization result

It is a visualization result for each item.

Comprehensive

pricemap2019_general.png

Overall, prices in Tokyo and Kanagawa seem to be 4-5% higher than the national average. However, it is not always the case that prices in the city are high. For example, prices in Osaka prefecture are below the national average of 99.7, but rather in neighboring Kyoto prefecture 100.6 and Hyogo prefecture 100.3 are higher. It seems.

Comprehensive excluding rent

pricemap2019_general_except_housing.png

Even excluding rent, prices in Tokyo and Kanagawa remained at the top and second rankings. However, the difference in scale is slightly smaller than the comprehensive index that does not exclude rent.

1. Food

pricemap2019_food.png

The cheapest food prices were in Nagano prefecture 95.2, followed by Fukuoka prefecture 95.8. The highest prices are in Fukui prefecture 103.8, Ishikawa prefecture 103.6, Tokyo metropolitan area 103.4, and Okinawa prefecture 103.2, and it seems that food prices in Hokuriku, Tokyo, and Okinawa are high.

2. Housing

pricemap2019_housing.png

The housing price was 132.3 in Tokyo and 125.1 in Kanagawa prefecture, which was an overwhelming difference from other prefectures. The cheapest housing price was in Tottori prefecture 81.7, followed by Ehime prefecture 82.4. Fukuoka prefecture is also cheap at 84.6, so it seems that the housing price is not necessarily high just because it is in the city.

3. Furniture / household items

pricemap2019_furniture.png

The index of furniture and household items is in the range of 94-104, so it seems that there is not much difference in the whole country. Miyagi prefecture had the highest value of 104.9, and Gifu prefecture had the lowest value of 94.0.

4. Transportation / communication

pricemap2019_transportation.png

The transportation and communication price index is in the range of 96-105, so the regional difference is unlikely to be so large. The highest was Tokyo with 104.8, and the next highest was Kanagawa with 103.2. The cheapest was 96.5 in Okayama prefecture.

5. Light and water

pricemap2019_utility.png

Hokkaido has the highest index of utility and water prices, and it can be seen that it tends to be high in the Tohoku region and the Chugoku / Shikoku region. Contrary to housing costs, it is said that the smaller the population, the higher the burden on each person, and I think that tendency is emerging.

6. Clothing and footwear

pricemap2019_cloth.png

The difference in clothing prices seems to be fairly large, but it is unclear why such regional differences are occurring. The highest clothing price was in Tochigi prefecture 112.5, and the cheapest was in Kagoshima prefecture 90.6.

7. Insurance medical care

pricemap2019_healthcare.png

The insurance medical price index is in the range of 96-102, so there seems to be little regional difference.

8. Education

pricemap2019_education.png

Kyoto Prefecture had the highest education price at 115.6. Overall, the Kinki region looks expensive.

9. Culture and entertainment

pricemap2019_culture.png

The price of education and entertainment was top at 105.2 in Kanagawa prefecture. It seems to be higher near Tokyo and Osaka.

10. Miscellaneous expenses

pricemap2019_others.png

Since the price index of miscellaneous expenses is in the range of 94-104, the regional difference is not likely to be so large.

Ranking list

It is a ranking of each of the 10 major expenses.

Ranking Comprehensive food Residence Light, heat and water Furniture / household items Clothing and footwear Insurance medical Transportation / communication education Liberal arts and entertainment Miscellaneous expenses 家賃を除くComprehensive
1 Tokyo(104.7) Fukui prefecture(103.8) Tokyo(132.3) Hokkaido(116.4) Miyagi Prefecture(104.9) Tochigi Prefecture(112.5) Toyama Prefecture(101.9) Tokyo(104.8) Kyoto(115.6) Kanagawa Prefecture(105.2) Kagawa Prefecture(103.5) Tokyo(103.2)
2 Kanagawa Prefecture(104.0) Ishikawa Prefecture(103.6) Kanagawa Prefecture(125.1) Yamagata Prefecture(111.4) Tokyo(103.8) Tokushima Prefecture(110.0) Yamaguchi Prefecture(101.6) Kanagawa Prefecture(103.2) Kanagawa Prefecture(111.9) Saitama(104.3) Kanagawa Prefecture(102.6) Kanagawa Prefecture(103.0)
3 Saitama(101.0) Tokyo(103.4) Saitama(104.8) Shimane Prefecture(111.0) Nagasaki Prefecture(103.6) Nagasaki Prefecture(108.5) Kanagawa Prefecture(101.5) Kyoto(102.5) Osaka(109.2) Tokyo(104.1) Hyogo prefecture(102.4) Hokkaido(100.9)
45 Gunma Prefecture(96.6) Miyazaki prefecture(96.5) Saga Prefecture(83.6) Saitama(94.4) Wakayama Prefecture(95.9) Fukuoka Prefecture(94.0) Kyoto(97.9) Tottori prefecture(97.1) Shizuoka Prefecture(86.0) Saga Prefecture(92.6) Miyazaki prefecture(97.3) Gunma Prefecture(97.2)
46 Kagoshima prefecture(96.3) Fukuoka Prefecture(95.8) Ehime Prefecture(82.4) Gifu Prefecture(93.7) Yamagata Prefecture(94.6) Kagawa Prefecture(92.4) Yamagata Prefecture(97.0) Ibaraki Prefecture(96.8) Gunma Prefecture(85.4) Miyazaki prefecture(91.9) Okinawa Prefecture(94.8) Kagoshima prefecture(97.0)
47 Miyazaki prefecture(96.0) Nagano Prefecture(95.2) Tottori prefecture(81.7) Gunma Prefecture(91.5) Gifu Prefecture(94.0) Kagoshima prefecture(90.6) Oita Prefecture(96.9) Okayama Prefecture(96.5) Okayama Prefecture(84.4) Kagoshima prefecture(91.8) Kagoshima prefecture(97.3) Miyazaki prefecture(97.0)

Finally

Metropolitan areas other than Tokyo and Kanagawa prefectures (Osaka, Aichi, Fukuoka, Miyagi, etc.) do not seem to be so expensive, so it may be a good idea to live there.

Reference site

I was allowed to reference.

-Qiita --Visualization of data by prefecture -Python learning channel by PyQ --Let's visualize the analysis result on the map! -lighthouselab --Jupyter Notebook version displaying Japanese maps in Python

Recommended Posts

Differences in prices by prefecture (2019)
Visualization of data by prefecture
Sort by date in python
Solving "cubes in cubes" by combinatorial optimization
Sort by specifying conditions in CASTable
Differences in identity, equivalence, and aliases