Skip to content

Instantly share code, notes, and snippets.

@okwrtdsh
Last active November 5, 2023 13:35
Show Gist options
  • Save okwrtdsh/fbe749c26ff9b7140259a35f6035aab7 to your computer and use it in GitHub Desktop.
Save okwrtdsh/fbe749c26ff9b7140259a35f6035aab7 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "4d4f914c-7ae6-4c72-8641-dda68c6f1187",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"\"\"\"\n",
"2 種類の形式のスクレイピングした Web 上のデータを処理してみましょう\n",
"\n",
"stocks.json\n",
"[\n",
" ['13010', '極洋', 'プライム', '水産・農林業', '3月'], # [証券コード, 銘柄名, 市場区分, 業種, 決算期]\n",
" ...\n",
"]\n",
"\n",
"stocks2.json\n",
"[\n",
" {\n",
" 'code': '13010',\n",
" 'name': '極洋',\n",
" 'market_division': 'プライム',\n",
" 'industrial_sector': '水産・農林業',\n",
" 'fiscal_year_end': '3月'\n",
" },\n",
" ...\n",
"]\n",
"\"\"\"\n",
"with open(\"stocks.json\", \"r\") as f:\n",
" data1 = json.load(f)\n",
"with open(\"stocks2.json\", \"r\") as f:\n",
" data2 = json.load(f)"
]
},
{
"cell_type": "markdown",
"id": "018768a3-dcbc-49e4-9cc3-8d62b5985ed5",
"metadata": {},
"source": [
"1. それぞれのデータから **銘柄数**, **市場区分の一覧 (list)**, **業種の一覧(list)** を求めてみましょう\n",
"2. 決算期別業種ランキング上位 3 位を求めてみましょう\n",
" * 単純合計数\n",
" * 業種内割合\n",
" * フォーマット\n",
" ```python\n",
" '{N}月 {RANK} 位:\\t{業種} ({数})'\n",
" ```"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "4746c80a-7598-482d-8544-30ea990bee80",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3826 3826\n"
]
}
],
"source": [
"# 銘柄数\n",
"print(len(data1), len(data2))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "8f2e0e59-0a4a-4118-8094-79b0ca278fd7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['プライム', 'スタンダード', 'グロース']\n",
"['グロース', 'プライム', 'スタンダード']\n",
"['プライム', 'スタンダード', 'グロース']\n",
"['グロース', 'プライム', 'スタンダード']\n"
]
}
],
"source": [
"# 市場区分の list\n",
"# data1\n",
"market_division_list = []\n",
"for d in data1:\n",
" if d[2] not in market_division_list: # 2: 市場区分\n",
" market_division_list.append(d[2])\n",
"print(market_division_list)\n",
"\n",
"print(list(set(map(lambda x: x[2], data1))))\n",
"\n",
"# data2\n",
"market_division_list = []\n",
"for d in data2:\n",
" if d['market_division'] not in market_division_list:\n",
" market_division_list.append(d['market_division'])\n",
"print(market_division_list)\n",
"\n",
"print(list(set(map(lambda x: x['market_division'], data2))))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "81d8dca9-cd63-4760-ad29-26f356a702ef",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['水産・農林業', '建設業', '不動産業', '非鉄金属', '鉱業', 'サービス業', '機械', '金属製品', '情報・通信業', '食料品', '医薬品', '陸運業', 'その他金融業', '小売業', '卸売業', '化学', '繊維製品', '電気機器', 'ガラス・土石製品', '証券、商品先物取引業', '輸送用機器', '石油・石炭製品', 'パルプ・紙', '精密機器', 'ゴム製品', '鉄鋼', '銀行業', 'その他製品', '保険業', '倉庫・運輸関連業', '海運業', '空運業', '電気・ガス業']\n",
"['その他製品', 'その他金融業', 'ガラス・土石製品', 'ゴム製品', 'サービス業', 'パルプ・紙', '不動産業', '保険業', '倉庫・運輸関連業', '化学', '医薬品', '卸売業', '小売業', '建設業', '情報・通信業', '機械', '水産・農林業', '海運業', '石油・石炭製品', '空運業', '精密機器', '繊維製品', '証券、商品先物取引業', '輸送用機器', '金属製品', '鉄鋼', '鉱業', '銀行業', '陸運業', '電気・ガス業', '電気機器', '非鉄金属', '食料品']\n",
"['水産・農林業', '建設業', '不動産業', '非鉄金属', '鉱業', 'サービス業', '機械', '金属製品', '情報・通信業', '食料品', '医薬品', '陸運業', 'その他金融業', '小売業', '卸売業', '化学', '繊維製品', '電気機器', 'ガラス・土石製品', '証券、商品先物取引業', '輸送用機器', '石油・石炭製品', 'パルプ・紙', '精密機器', 'ゴム製品', '鉄鋼', '銀行業', 'その他製品', '保険業', '倉庫・運輸関連業', '海運業', '空運業', '電気・ガス業']\n",
"['その他製品', 'その他金融業', 'ガラス・土石製品', 'ゴム製品', 'サービス業', 'パルプ・紙', '不動産業', '保険業', '倉庫・運輸関連業', '化学', '医薬品', '卸売業', '小売業', '建設業', '情報・通信業', '機械', '水産・農林業', '海運業', '石油・石炭製品', '空運業', '精密機器', '繊維製品', '証券、商品先物取引業', '輸送用機器', '金属製品', '鉄鋼', '鉱業', '銀行業', '陸運業', '電気・ガス業', '電気機器', '非鉄金属', '食料品']\n"
]
}
],
"source": [
"# 業種の list\n",
"# data1\n",
"industrial_sector_list = []\n",
"for d in data1:\n",
" if d[3] not in industrial_sector_list: # 3: 業種\n",
" industrial_sector_list.append(d[3])\n",
"print(industrial_sector_list)\n",
"\n",
"print(sorted(set(map(lambda x: x[3], data1))))\n",
"\n",
"# data2\n",
"industrial_sector_list = []\n",
"for d in data2:\n",
" if d['industrial_sector'] not in industrial_sector_list:\n",
" industrial_sector_list.append(d['industrial_sector'])\n",
"print(industrial_sector_list)\n",
"\n",
"print(sorted(set(map(lambda x: x['industrial_sector'], data2))))"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "db5b0439-dd12-4e07-96c2-c2cf5cc6bdcb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1月 1 位:\t情報・通信業 (15)\n",
"1月 2 位:\tサービス業 (9)\n",
"1月 3 位:\t小売業 (9)\n",
"\n",
"2月 1 位:\t小売業 (93)\n",
"2月 2 位:\tサービス業 (33)\n",
"2月 3 位:\t情報・通信業 (22)\n",
"\n",
"3月 1 位:\t情報・通信業 (243)\n",
"3月 2 位:\tサービス業 (216)\n",
"3月 3 位:\t卸売業 (208)\n",
"\n",
"4月 1 位:\t情報・通信業 (9)\n",
"4月 2 位:\t小売業 (7)\n",
"4月 3 位:\t建設業 (4)\n",
"\n",
"5月 1 位:\tサービス業 (17)\n",
"5月 2 位:\t情報・通信業 (17)\n",
"5月 3 位:\t小売業 (13)\n",
"\n",
"6月 1 位:\t情報・通信業 (40)\n",
"6月 2 位:\tサービス業 (34)\n",
"6月 3 位:\t小売業 (13)\n",
"\n",
"7月 1 位:\t情報・通信業 (14)\n",
"7月 2 位:\tサービス業 (13)\n",
"7月 3 位:\t小売業 (9)\n",
"\n",
"8月 1 位:\t情報・通信業 (25)\n",
"8月 2 位:\tサービス業 (18)\n",
"8月 3 位:\t小売業 (17)\n",
"\n",
"9月 1 位:\tサービス業 (58)\n",
"9月 2 位:\t情報・通信業 (56)\n",
"9月 3 位:\t不動産業 (14)\n",
"\n",
"10月 1 位:\tサービス業 (18)\n",
"10月 2 位:\t情報・通信業 (14)\n",
"10月 3 位:\t不動産業 (7)\n",
"\n",
"11月 1 位:\tサービス業 (13)\n",
"11月 2 位:\t情報・通信業 (9)\n",
"11月 3 位:\t卸売業 (8)\n",
"\n",
"12月 1 位:\t情報・通信業 (126)\n",
"12月 2 位:\tサービス業 (97)\n",
"12月 3 位:\t電気機器 (33)\n",
"\n"
]
}
],
"source": [
"# 単純合計数\n",
"# data1\n",
"rank = {}\n",
"for d in data1:\n",
" if d[4] not in rank: # 4: 決算期\n",
" rank[d[4]] = {d[3]: 1} # 3: 業種\n",
" elif d[3] not in rank[d[4]]:\n",
" rank[d[4]][d[3]] = 1\n",
" else:\n",
" rank[d[4]][d[3]] += 1\n",
"for i in range(1, 13):\n",
" for j, (industrial_sector, num) in enumerate(sorted(rank[f\"{i}月\"].items(), key=lambda x: -x[1])[:3], start=1):\n",
" print(f'{i}月 {j} 位:\\t{industrial_sector} ({num})')\n",
" print()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "653defcb-a790-43d5-b395-859dcba4b117",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1月 1 位:\t情報・通信業 (15)\n",
"1月 2 位:\tサービス業 (9)\n",
"1月 3 位:\t小売業 (9)\n",
"\n",
"2月 1 位:\t小売業 (93)\n",
"2月 2 位:\tサービス業 (33)\n",
"2月 3 位:\t情報・通信業 (22)\n",
"\n",
"3月 1 位:\t情報・通信業 (243)\n",
"3月 2 位:\tサービス業 (216)\n",
"3月 3 位:\t卸売業 (208)\n",
"\n",
"4月 1 位:\t情報・通信業 (9)\n",
"4月 2 位:\t小売業 (7)\n",
"4月 3 位:\t建設業 (4)\n",
"\n",
"5月 1 位:\tサービス業 (17)\n",
"5月 2 位:\t情報・通信業 (17)\n",
"5月 3 位:\t小売業 (13)\n",
"\n",
"6月 1 位:\t情報・通信業 (40)\n",
"6月 2 位:\tサービス業 (34)\n",
"6月 3 位:\t小売業 (13)\n",
"\n",
"7月 1 位:\t情報・通信業 (14)\n",
"7月 2 位:\tサービス業 (13)\n",
"7月 3 位:\t小売業 (9)\n",
"\n",
"8月 1 位:\t情報・通信業 (25)\n",
"8月 2 位:\tサービス業 (18)\n",
"8月 3 位:\t小売業 (17)\n",
"\n",
"9月 1 位:\tサービス業 (58)\n",
"9月 2 位:\t情報・通信業 (56)\n",
"9月 3 位:\t不動産業 (14)\n",
"\n",
"10月 1 位:\tサービス業 (18)\n",
"10月 2 位:\t情報・通信業 (14)\n",
"10月 3 位:\t不動産業 (7)\n",
"\n",
"11月 1 位:\tサービス業 (13)\n",
"11月 2 位:\t情報・通信業 (9)\n",
"11月 3 位:\t卸売業 (8)\n",
"\n",
"12月 1 位:\t情報・通信業 (126)\n",
"12月 2 位:\tサービス業 (97)\n",
"12月 3 位:\t電気機器 (33)\n",
"\n"
]
}
],
"source": [
"# data2\n",
"rank = {}\n",
"for d in data2:\n",
" if d['fiscal_year_end'] not in rank:\n",
" rank[d['fiscal_year_end']] = {d['industrial_sector']: 1}\n",
" elif d['industrial_sector'] not in rank[d['fiscal_year_end']]:\n",
" rank[d['fiscal_year_end']][d['industrial_sector']] = 1\n",
" else:\n",
" rank[d['fiscal_year_end']][d['industrial_sector']] += 1\n",
"for i in range(1, 13):\n",
" for j, (industrial_sector, num) in enumerate(sorted(rank[f\"{i}月\"].items(), key=lambda x: -x[1])[:3], start=1):\n",
" print(f'{i}月 {j} 位:\\t{industrial_sector} ({num})')\n",
" print()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "1a6b4cdf-3c20-45b5-aa87-a566c4319dbe",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1月 1 位:\tパルプ・紙 (4.00%)\n",
"1月 2 位:\t不動産業 (2.78%)\n",
"1月 3 位:\t小売業 (2.64%)\n",
"\n",
"2月 1 位:\t小売業 (27.57%)\n",
"2月 2 位:\t繊維製品 (10.00%)\n",
"2月 3 位:\t石油・石炭製品 (9.09%)\n",
"\n",
"3月 1 位:\t銀行業 (100.00%)\n",
"3月 2 位:\t陸運業 (91.80%)\n",
"3月 3 位:\t海運業 (91.67%)\n",
"\n",
"4月 1 位:\t食料品 (3.17%)\n",
"4月 2 位:\t金属製品 (2.25%)\n",
"4月 3 位:\t小売業 (2.05%)\n",
"\n",
"5月 1 位:\t水産・農林業 (15.38%)\n",
"5月 2 位:\t不動産業 (4.17%)\n",
"5月 3 位:\tパルプ・紙 (4.00%)\n",
"\n",
"6月 1 位:\t水産・農林業 (15.38%)\n",
"6月 2 位:\t保険業 (7.14%)\n",
"6月 3 位:\t情報・通信業 (6.77%)\n",
"\n",
"7月 1 位:\t不動産業 (4.86%)\n",
"7月 2 位:\t小売業 (2.64%)\n",
"7月 3 位:\tサービス業 (2.45%)\n",
"\n",
"8月 1 位:\t小売業 (4.99%)\n",
"8月 2 位:\t情報・通信業 (4.23%)\n",
"8月 3 位:\t繊維製品 (4.00%)\n",
"\n",
"9月 1 位:\t空運業 (14.29%)\n",
"9月 2 位:\tその他金融業 (13.16%)\n",
"9月 3 位:\tサービス業 (10.94%)\n",
"\n",
"10月 1 位:\t水産・農林業 (7.69%)\n",
"10月 2 位:\t不動産業 (4.86%)\n",
"10月 3 位:\tその他製品 (4.63%)\n",
"\n",
"11月 1 位:\t保険業 (7.14%)\n",
"11月 2 位:\t倉庫・運輸関連業 (5.41%)\n",
"11月 3 位:\t不動産業 (4.17%)\n",
"\n",
"12月 1 位:\t医薬品 (33.77%)\n",
"12月 2 位:\tゴム製品 (31.58%)\n",
"12月 3 位:\t鉱業 (28.57%)\n",
"\n"
]
}
],
"source": [
"# 業種内割合\n",
"# data1\n",
"rank = {}\n",
"for d in data1:\n",
" if d[3] not in rank: # 3: 業種\n",
" rank[d[3]] = {d[4]: 1} # 4: 決算期\n",
" elif d[4] not in rank[d[3]]:\n",
" rank[d[3]][d[4]] = 1\n",
" else:\n",
" rank[d[3]][d[4]] += 1\n",
"for industrial_sector, dict_fiscal_year_end in rank.items():\n",
" total = sum(dict_fiscal_year_end.values())\n",
" for fiscal_year_end in dict_fiscal_year_end:\n",
" rank[industrial_sector][fiscal_year_end] /= total\n",
"for i in range(1, 13):\n",
" for j, (industrial_sector, dict_fiscal_year_end) in enumerate(\n",
" sorted(rank.items(), key=lambda x: -x[1].get(f'{i}月', 0))[:3],\n",
" start=1):\n",
" print(f'{i}月 {j} 位:\\t{industrial_sector} ({dict_fiscal_year_end[f\"{i}月\"]:.2%})')\n",
" print()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "5d21d9eb-a505-436e-a2cc-ad0dcd326bc2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1月 1 位:\tパルプ・紙 (4.00%)\n",
"1月 2 位:\t不動産業 (2.78%)\n",
"1月 3 位:\t小売業 (2.64%)\n",
"\n",
"2月 1 位:\t小売業 (27.57%)\n",
"2月 2 位:\t繊維製品 (10.00%)\n",
"2月 3 位:\t石油・石炭製品 (9.09%)\n",
"\n",
"3月 1 位:\t銀行業 (100.00%)\n",
"3月 2 位:\t陸運業 (91.80%)\n",
"3月 3 位:\t海運業 (91.67%)\n",
"\n",
"4月 1 位:\t食料品 (3.17%)\n",
"4月 2 位:\t金属製品 (2.25%)\n",
"4月 3 位:\t小売業 (2.05%)\n",
"\n",
"5月 1 位:\t水産・農林業 (15.38%)\n",
"5月 2 位:\t不動産業 (4.17%)\n",
"5月 3 位:\tパルプ・紙 (4.00%)\n",
"\n",
"6月 1 位:\t水産・農林業 (15.38%)\n",
"6月 2 位:\t保険業 (7.14%)\n",
"6月 3 位:\t情報・通信業 (6.77%)\n",
"\n",
"7月 1 位:\t不動産業 (4.86%)\n",
"7月 2 位:\t小売業 (2.64%)\n",
"7月 3 位:\tサービス業 (2.45%)\n",
"\n",
"8月 1 位:\t小売業 (4.99%)\n",
"8月 2 位:\t情報・通信業 (4.23%)\n",
"8月 3 位:\t繊維製品 (4.00%)\n",
"\n",
"9月 1 位:\t空運業 (14.29%)\n",
"9月 2 位:\tその他金融業 (13.16%)\n",
"9月 3 位:\tサービス業 (10.94%)\n",
"\n",
"10月 1 位:\t水産・農林業 (7.69%)\n",
"10月 2 位:\t不動産業 (4.86%)\n",
"10月 3 位:\tその他製品 (4.63%)\n",
"\n",
"11月 1 位:\t保険業 (7.14%)\n",
"11月 2 位:\t倉庫・運輸関連業 (5.41%)\n",
"11月 3 位:\t不動産業 (4.17%)\n",
"\n",
"12月 1 位:\t医薬品 (33.77%)\n",
"12月 2 位:\tゴム製品 (31.58%)\n",
"12月 3 位:\t鉱業 (28.57%)\n",
"\n"
]
}
],
"source": [
"# 業種内割合\n",
"# data2\n",
"rank = {}\n",
"for d in data2:\n",
" if d['industrial_sector'] not in rank:\n",
" rank[d['industrial_sector']] = {d['fiscal_year_end']: 1}\n",
" elif d['fiscal_year_end'] not in rank[d['industrial_sector']]:\n",
" rank[d['industrial_sector']][d['fiscal_year_end']] = 1\n",
" else:\n",
" rank[d['industrial_sector']][d['fiscal_year_end']] += 1\n",
"for industrial_sector, dict_fiscal_year_end in rank.items():\n",
" total = sum(dict_fiscal_year_end.values())\n",
" for fiscal_year_end in dict_fiscal_year_end:\n",
" rank[industrial_sector][fiscal_year_end] /= total\n",
"for i in range(1, 13):\n",
" for j, (industrial_sector, dict_fiscal_year_end) in enumerate(\n",
" sorted(rank.items(), key=lambda x: -x[1].get(f'{i}月', 0))[:3],\n",
" start=1):\n",
" print(f'{i}月 {j} 位:\\t{industrial_sector} ({dict_fiscal_year_end[f\"{i}月\"]:.2%})')\n",
" print()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "2d00fdc6-170f-4be2-8fdb-96d60540f42a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{\n",
" \"その他製品\": {\n",
" \"10月\": 0.046296296296296294,\n",
" \"11月\": 0.018518518518518517,\n",
" \"12月\": 0.1574074074074074,\n",
" \"1月\": 0.018518518518518517,\n",
" \"2月\": 0.046296296296296294,\n",
" \"3月\": 0.5370370370370371,\n",
" \"4月\": 0.009259259259259259,\n",
" \"5月\": 0.018518518518518517,\n",
" \"6月\": 0.06481481481481481,\n",
" \"7月\": 0.018518518518518517,\n",
" \"8月\": 0.018518518518518517,\n",
" \"9月\": 0.046296296296296294\n",
" },\n",
" \"その他金融業\": {\n",
" \"12月\": 0.05263157894736842,\n",
" \"1月\": 0.02631578947368421,\n",
" \"2月\": 0.02631578947368421,\n",
" \"3月\": 0.7368421052631579,\n",
" \"6月\": 0.02631578947368421,\n",
" \"9月\": 0.13157894736842105\n",
" },\n",
" \"ガラス・土石製品\": {\n",
" \"10月\": 0.01818181818181818,\n",
" \"11月\": 0.01818181818181818,\n",
" \"12月\": 0.14545454545454545,\n",
" \"2月\": 0.01818181818181818,\n",
" \"3月\": 0.7636363636363637,\n",
" \"4月\": 0.01818181818181818,\n",
" \"6月\": 0.01818181818181818\n",
" },\n",
" \"ゴム製品\": {\n",
" \"12月\": 0.3157894736842105,\n",
" \"3月\": 0.6842105263157895\n",
" },\n",
" \"サービス業\": {\n",
" \"10月\": 0.033962264150943396,\n",
" \"11月\": 0.022641509433962263,\n",
" \"12月\": 0.1830188679245283,\n",
" \"1月\": 0.016981132075471698,\n",
" \"2月\": 0.062264150943396226,\n",
" \"3月\": 0.40943396226415096,\n",
" \"4月\": 0.007547169811320755,\n",
" \"5月\": 0.03207547169811321,\n",
" \"6月\": 0.06415094339622641,\n",
" \"7月\": 0.024528301886792454,\n",
" \"8月\": 0.033962264150943396,\n",
" \"9月\": 0.10943396226415095\n",
" },\n",
" \"パルプ・紙\": {\n",
" \"12月\": 0.16,\n",
" \"1月\": 0.04,\n",
" \"3月\": 0.72,\n",
" \"5月\": 0.04,\n",
" \"6月\": 0.04\n",
" },\n",
" \"不動産業\": {\n",
" \"10月\": 0.04861111111111111,\n",
" \"11月\": 0.041666666666666664,\n",
" \"12月\": 0.1597222222222222,\n",
" \"1月\": 0.027777777777777776,\n",
" \"2月\": 0.04861111111111111,\n",
" \"3月\": 0.3958333333333333,\n",
" \"5月\": 0.041666666666666664,\n",
" \"6月\": 0.0625,\n",
" \"7月\": 0.04861111111111111,\n",
" \"8月\": 0.027777777777777776,\n",
" \"9月\": 0.09722222222222222\n",
" },\n",
" \"保険業\": {\n",
" \"11月\": 0.07142857142857142,\n",
" \"3月\": 0.7857142857142857,\n",
" \"6月\": 0.07142857142857142,\n",
" \"9月\": 0.07142857142857142\n",
" },\n",
" \"倉庫・運輸関連業\": {\n",
" \"11月\": 0.05405405405405406,\n",
" \"12月\": 0.05405405405405406,\n",
" \"2月\": 0.05405405405405406,\n",
" \"3月\": 0.8108108108108109,\n",
" \"6月\": 0.02702702702702703\n",
" },\n",
" \"化学\": {\n",
" \"10月\": 0.009302325581395349,\n",
" \"11月\": 0.018604651162790697,\n",
" \"12月\": 0.15348837209302327,\n",
" \"1月\": 0.009302325581395349,\n",
" \"2月\": 0.013953488372093023,\n",
" \"3月\": 0.7302325581395349,\n",
" \"4月\": 0.004651162790697674,\n",
" \"5月\": 0.009302325581395349,\n",
" \"6月\": 0.009302325581395349,\n",
" \"7月\": 0.009302325581395349,\n",
" \"8月\": 0.004651162790697674,\n",
" \"9月\": 0.027906976744186046\n",
" },\n",
" \"医薬品\": {\n",
" \"10月\": 0.012987012987012988,\n",
" \"12月\": 0.33766233766233766,\n",
" \"1月\": 0.012987012987012988,\n",
" \"2月\": 0.025974025974025976,\n",
" \"3月\": 0.5324675324675324,\n",
" \"5月\": 0.025974025974025976,\n",
" \"6月\": 0.012987012987012988,\n",
" \"7月\": 0.012987012987012988,\n",
" \"9月\": 0.025974025974025976\n",
" },\n",
" \"卸売業\": {\n",
" \"10月\": 0.0165016501650165,\n",
" \"11月\": 0.026402640264026403,\n",
" \"12月\": 0.07260726072607261,\n",
" \"1月\": 0.0231023102310231,\n",
" \"2月\": 0.033003300330033,\n",
" \"3月\": 0.6864686468646864,\n",
" \"4月\": 0.013201320132013201,\n",
" \"5月\": 0.0297029702970297,\n",
" \"6月\": 0.026402640264026403,\n",
" \"7月\": 0.0033003300330033004,\n",
" \"8月\": 0.026402640264026403,\n",
" \"9月\": 0.0429042904290429\n",
" },\n",
" \"小売業\": {\n",
" \"10月\": 0.01466275659824047,\n",
" \"11月\": 0.008797653958944282,\n",
" \"12月\": 0.05278592375366569,\n",
" \"1月\": 0.026392961876832845,\n",
" \"2月\": 0.2756598240469208,\n",
" \"3月\": 0.41348973607038125,\n",
" \"4月\": 0.020527859237536656,\n",
" \"5月\": 0.03812316715542522,\n",
" \"6月\": 0.03812316715542522,\n",
" \"7月\": 0.026392961876832845,\n",
" \"8月\": 0.04985337243401759,\n",
" \"9月\": 0.03519061583577713\n",
" },\n",
" \"建設業\": {\n",
" \"10月\": 0.012903225806451613,\n",
" \"11月\": 0.0064516129032258064,\n",
" \"12月\": 0.07096774193548387,\n",
" \"1月\": 0.01935483870967742,\n",
" \"2月\": 0.01935483870967742,\n",
" \"3月\": 0.7096774193548387,\n",
" \"4月\": 0.01935483870967742,\n",
" \"5月\": 0.025806451612903226,\n",
" \"6月\": 0.04516129032258064,\n",
" \"7月\": 0.012903225806451613,\n",
" \"8月\": 0.01935483870967742,\n",
" \"9月\": 0.03870967741935484\n",
" },\n",
" \"情報・通信業\": {\n",
" \"10月\": 0.023688663282571912,\n",
" \"11月\": 0.015228426395939087,\n",
" \"12月\": 0.2131979695431472,\n",
" \"1月\": 0.025380710659898477,\n",
" \"2月\": 0.03722504230118443,\n",
" \"3月\": 0.4128595600676819,\n",
" \"4月\": 0.015228426395939087,\n",
" \"5月\": 0.028764805414551606,\n",
" \"6月\": 0.0676818950930626,\n",
" \"7月\": 0.023688663282571912,\n",
" \"8月\": 0.04230118443316413,\n",
" \"9月\": 0.09475465313028765\n",
" },\n",
" \"機械\": {\n",
" \"10月\": 0.004464285714285714,\n",
" \"11月\": 0.017857142857142856,\n",
" \"12月\": 0.14732142857142858,\n",
" \"1月\": 0.004464285714285714,\n",
" \"2月\": 0.026785714285714284,\n",
" \"3月\": 0.7098214285714286,\n",
" \"5月\": 0.013392857142857142,\n",
" \"6月\": 0.022321428571428572,\n",
" \"7月\": 0.008928571428571428,\n",
" \"8月\": 0.017857142857142856,\n",
" \"9月\": 0.026785714285714284\n",
" },\n",
" \"水産・農林業\": {\n",
" \"10月\": 0.07692307692307693,\n",
" \"3月\": 0.6153846153846154,\n",
" \"5月\": 0.15384615384615385,\n",
" \"6月\": 0.15384615384615385\n",
" },\n",
" \"海運業\": {\n",
" \"12月\": 0.08333333333333333,\n",
" \"3月\": 0.9166666666666666\n",
" },\n",
" \"石油・石炭製品\": {\n",
" \"12月\": 0.18181818181818182,\n",
" \"2月\": 0.09090909090909091,\n",
" \"3月\": 0.7272727272727273\n",
" },\n",
" \"空運業\": {\n",
" \"3月\": 0.8571428571428571,\n",
" \"9月\": 0.14285714285714285\n",
" },\n",
" \"精密機器\": {\n",
" \"12月\": 0.14,\n",
" \"2月\": 0.02,\n",
" \"3月\": 0.66,\n",
" \"4月\": 0.02,\n",
" \"5月\": 0.04,\n",
" \"6月\": 0.06,\n",
" \"8月\": 0.02,\n",
" \"9月\": 0.04\n",
" },\n",
" \"繊維製品\": {\n",
" \"11月\": 0.02,\n",
" \"12月\": 0.12,\n",
" \"1月\": 0.02,\n",
" \"2月\": 0.1,\n",
" \"3月\": 0.64,\n",
" \"4月\": 0.02,\n",
" \"5月\": 0.02,\n",
" \"6月\": 0.02,\n",
" \"8月\": 0.04\n",
" },\n",
" \"証券、商品先物取引業\": {\n",
" \"12月\": 0.11904761904761904,\n",
" \"3月\": 0.8571428571428571,\n",
" \"9月\": 0.023809523809523808\n",
" },\n",
" \"輸送用機器\": {\n",
" \"10月\": 0.02197802197802198,\n",
" \"12月\": 0.04395604395604396,\n",
" \"3月\": 0.9120879120879121,\n",
" \"6月\": 0.01098901098901099,\n",
" \"8月\": 0.01098901098901099\n",
" },\n",
" \"金属製品\": {\n",
" \"11月\": 0.011235955056179775,\n",
" \"12月\": 0.12359550561797752,\n",
" \"2月\": 0.02247191011235955,\n",
" \"3月\": 0.6629213483146067,\n",
" \"4月\": 0.02247191011235955,\n",
" \"5月\": 0.033707865168539325,\n",
" \"6月\": 0.06741573033707865,\n",
" \"7月\": 0.02247191011235955,\n",
" \"8月\": 0.011235955056179775,\n",
" \"9月\": 0.02247191011235955\n",
" },\n",
" \"鉄鋼\": {\n",
" \"12月\": 0.09302325581395349,\n",
" \"3月\": 0.8837209302325582,\n",
" \"6月\": 0.023255813953488372\n",
" },\n",
" \"鉱業\": {\n",
" \"12月\": 0.2857142857142857,\n",
" \"3月\": 0.7142857142857143\n",
" },\n",
" \"銀行業\": {\n",
" \"3月\": 1.0\n",
" },\n",
" \"陸運業\": {\n",
" \"12月\": 0.06557377049180328,\n",
" \"3月\": 0.9180327868852459,\n",
" \"6月\": 0.01639344262295082\n",
" },\n",
" \"電気・ガス業\": {\n",
" \"12月\": 0.11538461538461539,\n",
" \"3月\": 0.8461538461538461,\n",
" \"6月\": 0.038461538461538464\n",
" },\n",
" \"電気機器\": {\n",
" \"11月\": 0.0125,\n",
" \"12月\": 0.14166666666666666,\n",
" \"1月\": 0.025,\n",
" \"2月\": 0.020833333333333332,\n",
" \"3月\": 0.725,\n",
" \"4月\": 0.008333333333333333,\n",
" \"5月\": 0.008333333333333333,\n",
" \"6月\": 0.029166666666666667,\n",
" \"7月\": 0.004166666666666667,\n",
" \"8月\": 0.008333333333333333,\n",
" \"9月\": 0.016666666666666666\n",
" },\n",
" \"非鉄金属\": {\n",
" \"12月\": 0.11428571428571428,\n",
" \"2月\": 0.02857142857142857,\n",
" \"3月\": 0.8285714285714286,\n",
" \"9月\": 0.02857142857142857\n",
" },\n",
" \"食料品\": {\n",
" \"11月\": 0.015873015873015872,\n",
" \"12月\": 0.16666666666666666,\n",
" \"1月\": 0.015873015873015872,\n",
" \"2月\": 0.05555555555555555,\n",
" \"3月\": 0.6507936507936508,\n",
" \"4月\": 0.031746031746031744,\n",
" \"5月\": 0.007936507936507936,\n",
" \"6月\": 0.023809523809523808,\n",
" \"7月\": 0.007936507936507936,\n",
" \"8月\": 0.007936507936507936,\n",
" \"9月\": 0.015873015873015872\n",
" }\n",
"}\n"
]
}
],
"source": [
"print(json.dumps(rank, indent=4, ensure_ascii=False, sort_keys=True))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7641ebb9-fbc7-40fc-b78d-dd46072ae2b7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment