{"image_url":null,"blog_title":"shikaku's blog","url":"https://blog.systemjp.net/entry/2023/07/05/094949","type":"rich","author_name":"shikaku","blog_url":"https://blog.systemjp.net/","width":"100%","title":"python xls\u304b\u3089\u6307\u5b9a\u5217\u306e\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u53d6\u3063\u3066csv\u51fa\u529b","provider_name":"Hatena Blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.systemjp.net%2Fentry%2F2023%2F07%2F05%2F094949\" title=\"python xls\u304b\u3089\u6307\u5b9a\u5217\u306e\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u53d6\u3063\u3066csv\u51fa\u529b - shikaku&#39;s blog\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","categories":[],"published":"2023-07-05 09:49:49","version":"1.0","description":"import pandas as pd # xls\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\uff085\u884c\u76ee\u304b\u3089\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\uff09 df = pd.read_excel('jpx_\u914d\u5f53\u843d\u6a29\u5229\u843d\u7b49\u60c5\u5831.xls', skiprows=4) # E\u5217\u3068C\u5217\u306e\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\uff08Python\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f0\u304b\u3089\u59cb\u307e\u308b\u305f\u3081\u3001E\u5217\u306f4\u3001C\u5217\u306f2\u3068\u306a\u308a\u307e\u3059\uff09 df = df.iloc[:, [4, 2]] # \u30d8\u30c3\u30c0\u3092\u8a2d\u5b9a df.columns = ['\u30b3\u30fc\u30c9', '\u6a29\u5229\u843d\u3061\u65e5'] # \u30b3\u30fc\u30c9\u5217\u306e\u5185\u5bb9\u3092\u6587\u5b57\u5217\u306b\u5909\u63db\u3057\u3001\u5148\u982d4\u6587\u5b57\u3060\u3051\u306b\u3059\u308b df['\u30b3\u30fc\u30c9'] = df['\u30b3\u30fc\u30c9'].astype(str).str[:4] # \u30c7\u30fc\u30bf\u3092csv\u30d5\u30a1\u30a4\u2026","provider_url":"https://hatena.blog","author_url":"https://blog.hatena.ne.jp/shikaku/","height":"190"}