Created
November 3, 2023 16:03
-
-
Save okwrtdsh/39b195b54acda3809ae3929a1ec933f4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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": null, | |
"id": "a2b34565-0498-423c-bc9c-083065777380", | |
"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