From 018fc93fc09e9baf7a9f4d014c2c508457c474e1 Mon Sep 17 00:00:00 2001 From: Tetsu Haruyama Date: Mon, 19 Aug 2024 23:14:57 +0900 Subject: [PATCH] .plot.xxxx() --- 11_Macro_Variables.ipynb | 43 +++++++++++++++------------------ 12_IS-MP-PC.ipynb | 12 ++++++--- 13_random_TFP.ipynb | 19 +++++++++------ 19_PPP.ipynb | 35 +++++++++++++-------------- 5a_Development_Accounting.ipynb | 12 ++++----- 5b_Growth_Accounting.ipynb | 24 ++++++++---------- 6_Regression.ipynb | 20 +++++++++------ 7_DifferenceEq.ipynb | 12 ++++++--- 8_Solow.ipynb | 18 +++++--------- 9_Convergence.ipynb | 25 +++++++++---------- 10 files changed, 109 insertions(+), 111 deletions(-) diff --git a/11_Macro_Variables.ipynb b/11_Macro_Variables.ipynb index aade6a80..27ff7461 100644 --- a/11_Macro_Variables.ipynb +++ b/11_Macro_Variables.ipynb @@ -39,8 +39,7 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true, - "jp-MarkdownHeadingCollapsed": true + "heading_collapsed": true }, "source": [ "## はじめに" @@ -502,13 +501,11 @@ }, "outputs": [], "source": [ - "ax_ = df.plot(x='u_rate_cycle',\n", - " y='gdp_cycle',\n", - " kind='scatter')\n", + "ax_ = df.plot.scatter(x='u_rate_cycle',\n", + " y='gdp_cycle')\n", "\n", "df.plot(x='u_rate_cycle',\n", " y='fitted_okun',\n", - " kind='line',\n", " color='red',\n", " ax=ax_)\n", "pass" @@ -542,7 +539,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "## フィリップス曲線" @@ -711,7 +709,8 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "### フラット化するフィリップス曲線" @@ -734,7 +733,7 @@ }, "outputs": [], "source": [ - "df.plot(x='unemployment_rate', y='inflation', kind='scatter')\n", + "df.plot.scatter(x='unemployment_rate', y='inflation')\n", "pass" ] }, @@ -909,13 +908,12 @@ " \n", " cond = ( df['decade']==d )\n", " \n", - " df.loc[cond,:].plot(x='unemployment_rate',\n", - " y='inflation',\n", - " kind='scatter',\n", - " edgecolor=c, #3\n", - " color='white', #4\n", - " legend=False,\n", - " ax=ax)\n", + " df.loc[cond,:].plot.scatter(x='unemployment_rate',\n", + " y='inflation',\n", + " edgecolor=c, #3\n", + " color='white', #4\n", + " legend=False,\n", + " ax=ax)\n", "\n", " df.loc[cond,:].sort_values(f'{d}年代データ').plot(\n", " x='unemployment_rate',\n", @@ -988,9 +986,7 @@ }, { "cell_type": "markdown", - "metadata": { - "jp-MarkdownHeadingCollapsed": true - }, + "metadata": {}, "source": [ "## インフレ率とマネーストックの増加率" ] @@ -998,8 +994,7 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true, - "jp-MarkdownHeadingCollapsed": true + "heading_collapsed": true }, "source": [ "### 説明" @@ -1539,7 +1534,7 @@ " res = smf.ols('inflation ~ money_growth', data=df).fit() #2\n", " df['トレンド'] = res.fittedvalues #3\n", " \n", - " ax_ = df.plot(x='money_growth', y='inflation', kind='scatter') #4\n", + " ax_ = df.plot.scatter(x='money_growth', y='inflation') #4\n", " df.sort_values('トレンド').plot(x='money_growth', y='トレンド', #5\n", " color='r', ax=ax_) #6\n", " ax_.set_title(f'{t}\\n' #7\n", @@ -2107,7 +2102,7 @@ }, "outputs": [], "source": [ - "world.plot(x='money_growth', y='inflation', kind='scatter')\n", + "world.plot.scatter(x='money_growth', y='inflation')\n", "pass" ] }, @@ -2318,7 +2313,7 @@ }, "outputs": [], "source": [ - "ax_ = world_mean.plot(x='money_growth_mean', y='inflation_mean', kind='scatter')\n", + "ax_ = world_mean.plot.scatter(x='money_growth_mean', y='inflation_mean')\n", "xpoints = ypoints = ax_.get_ylim()\n", "ax_.plot(xpoints,ypoints,'r-', label='45度線')\n", "ax_.set_title('平均インフレ率とマネーストトックの平均成長率', size='15')\n", diff --git a/12_IS-MP-PC.ipynb b/12_IS-MP-PC.ipynb index dfd0ee74..e212f157 100644 --- a/12_IS-MP-PC.ipynb +++ b/12_IS-MP-PC.ipynb @@ -81,6 +81,7 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true, "tags": [ "remove-cell" ] @@ -227,7 +228,8 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "### モデルの解" @@ -405,7 +407,8 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "### シミュレーション:インパルス反応" @@ -532,7 +535,8 @@ { "cell_type": "markdown", "metadata": { - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "#### フィリップス曲線のショック" @@ -1791,7 +1795,7 @@ "jp-MarkdownHeadingCollapsed": true }, "source": [ - "## IS-MP-PSモデルの問題点" + "## IS-MP-PCモデルの問題点" ] }, { diff --git a/13_random_TFP.ipynb b/13_random_TFP.ipynb index bca5d7ce..55ee3c3b 100644 --- a/13_random_TFP.ipynb +++ b/13_random_TFP.ipynb @@ -264,7 +264,7 @@ }, "outputs": [], "source": [ - "dfwn.plot(kind='hist', bins=30)\n", + "dfwn.plot.hist(bins=30)\n", "pass" ] }, @@ -333,7 +333,7 @@ }, "outputs": [], "source": [ - "dfwn.plot(x='WNlag', y='WN', kind='scatter')\n", + "dfwn.plot.scatter(x='WNlag', y='WN')\n", "pass" ] }, @@ -1267,7 +1267,7 @@ }, "outputs": [], "source": [ - "df.plot(x='tfp_cycle_lag', y='tfp_cycle', kind='scatter')\n", + "df.plot.scatter(x='tfp_cycle_lag', y='tfp_cycle')\n", "pass" ] }, @@ -1437,7 +1437,9 @@ }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "jp-MarkdownHeadingCollapsed": true + }, "source": [ "### 初期値の計算" ] @@ -1671,7 +1673,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "### シミュレーション" @@ -1681,7 +1684,8 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "#### 関数" @@ -1802,7 +1806,8 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "#### 実行" diff --git a/19_PPP.ipynb b/19_PPP.ipynb index 1b3645b9..8da143f1 100644 --- a/19_PPP.ipynb +++ b/19_PPP.ipynb @@ -382,7 +382,7 @@ }, "outputs": [], "source": [ - "choco.plot(y='mean_deviation', kind='hist', bins=12, ec='white')\n", + "choco.plot.hist(y='mean_deviation', bins=12, ec='white')\n", "pass" ] }, @@ -680,7 +680,7 @@ "source": [ "ice['mean_deviation'] = ice['price'] / ice['price'].mean() - 1\n", "\n", - "ice.plot(y='mean_deviation', kind='hist', bins=16, ec='white')\n", + "ice.plot.hist(y='mean_deviation', bins=16, ec='white')\n", "pass" ] }, @@ -939,7 +939,7 @@ "source": [ "gas['mean_deviation'] = gas['price'] / gas['price'].mean() - 1\n", "\n", - "gas.plot(y='mean_deviation', kind='hist', ec='white')\n", + "gas.plot.hist(y='mean_deviation', ec='white')\n", "pass" ] }, @@ -1052,7 +1052,6 @@ "id": "cc3f4f60", "metadata": { "heading_collapsed": true, - "jp-MarkdownHeadingCollapsed": true, "tags": [ "remove-cell" ] @@ -1229,7 +1228,8 @@ "id": "c5a9085a", "metadata": { "heading_collapsed": true, - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "### 一物一価" @@ -1535,7 +1535,7 @@ }, "outputs": [], "source": [ - "bigmac.plot(y='price_yen_deviation', kind='hist', ec='white')\n", + "bigmac.plot.hist(y='price_yen_deviation', ec='white')\n", "pass" ] }, @@ -1806,7 +1806,7 @@ }, "outputs": [], "source": [ - "ax = bigmac.plot(x='gdppc_yen', y='price_yen', kind='scatter', logx=True)\n", + "ax = bigmac.plot.scatter(x='gdppc_yen', y='price_yen', logx=True)\n", "ax.set_xlabel('一人当たり実質GDP(円,常用対数)', fontsize=15)\n", "ax.set_ylabel('Big Mac価格(円)', fontsize=15)\n", "pass" @@ -2397,7 +2397,7 @@ "source": [ "pwt19['pl_gdpo_log'] = np.log( pwt19['pl_gdpo'] )\n", "\n", - "pwt19.plot(y='pl_gdpo_log', kind='hist', ec='white')\n", + "pwt19.plot.hist(y='pl_gdpo_log', ec='white')\n", "pass" ] }, @@ -2729,7 +2729,7 @@ }, "outputs": [], "source": [ - "ax = pwt19.plot(x='cgdpo_pc_log', y='pl_gdpo_log', kind='scatter')\n", + "ax = pwt19.plot.scatter(x='cgdpo_pc_log', y='pl_gdpo_log')\n", "ax.set_xlabel('一人当たりGDP(対数,百万米ドル)', fontsize=15)\n", "ax.set_ylabel('米国の2017年価格を基準とした\\n2019年相対価格(対数)', fontsize=15)\n", "pass" @@ -3012,7 +3012,7 @@ "outputs": [], "source": [ "# 散布図\n", - "ax = pwt19.plot(x='cgdpo_pc_ratio_log', y='pl_gdpo_log', kind='scatter')\n", + "ax = pwt19.plot.scatter(x='cgdpo_pc_ratio_log', y='pl_gdpo_log')\n", "ax.set_xlabel('米国を基準とした一人当たりGDP(対数,2019年)', fontsize=15)\n", "ax.set_ylabel('米国の2017年価格を基準とした\\n2019年相対価格(対数)', fontsize=15)\n", "\n", @@ -3098,12 +3098,11 @@ "col_lst = ['pl_gdpo_log','income_effect','other_effect']\n", "title_lst = ['相対価格(対数)','所得効果(対数)','その他の効果(対数)']\n", "\n", - "ax = pwt19[col_lst].plot(kind='hist',\n", - " bins=20,\n", - " ec='white',\n", - " subplots=True,\n", - " legend=False,\n", - " figsize=(6,10))\n", + "ax = pwt19[col_lst].plot.hist(bins=20,\n", + " ec='white',\n", + " subplots=True,\n", + " legend=False,\n", + " figsize=(6,10))\n", "\n", "for i, s in enumerate(title_lst):\n", " ax[i].set_title(s, fontsize=18)\n", @@ -3603,7 +3602,7 @@ }, "outputs": [], "source": [ - "ax = pwt19.plot(x='cgdpo_pc_log', y='cgdpo_pc_xr_log', kind='scatter')\n", + "ax = pwt19.plot.scatter(x='cgdpo_pc_log', y='cgdpo_pc_xr_log')\n", "ax.axline((9, 9), (10, 10), color='red', label='45度線') #1\n", "ax.set_xlabel('一人当たりGDP(PPPレート)', fontsize=13)\n", "ax.set_ylabel('一人当たりGDP(市場為替レート)', fontsize=13)\n", @@ -3653,7 +3652,7 @@ }, "outputs": [], "source": [ - "ax = pwt19.plot(y=['cgdpo_pc_log','cgdpo_pc_xr_log'], kind='kde')\n", + "ax = pwt19.plot.kde(y=['cgdpo_pc_log','cgdpo_pc_xr_log'])\n", "ax.legend(['PPPレート','市場為替レート'], fontsize=13)\n", "ax.set_title('一人当たりGDP(米ドル,対数)', fontsize=20)\n", "pass" diff --git a/5a_Development_Accounting.ipynb b/5a_Development_Accounting.ipynb index 6878683d..4bf32ca2 100644 --- a/5a_Development_Accounting.ipynb +++ b/5a_Development_Accounting.ipynb @@ -907,7 +907,7 @@ }, "outputs": [], "source": [ - "df.plot(x='kpc_relative', y='gdppc_relative', kind='scatter')\n", + "df.plot.scatter(x='kpc_relative', y='gdppc_relative')\n", "pass" ] }, @@ -968,7 +968,7 @@ }, "outputs": [], "source": [ - "df.plot(x='hc_relative', y='gdppc_relative', kind='scatter')\n", + "df.plot.scatter(x='hc_relative', y='gdppc_relative')\n", "pass" ] }, @@ -1031,7 +1031,7 @@ }, "outputs": [], "source": [ - "df.plot(x='human_relative', y='gdppc_relative', kind='scatter')\n", + "df.plot.scatter(x='human_relative', y='gdppc_relative')\n", "pass" ] }, @@ -1054,7 +1054,7 @@ "source": [ "df['avh_relative'] = df['avh'] / us['avh'].iloc[0]\n", "\n", - "df.plot(x='avh_relative', y='gdppc_relative', kind='scatter')\n", + "df.plot.scatter(x='avh_relative', y='gdppc_relative')\n", "pass" ] }, @@ -1109,7 +1109,7 @@ "source": [ "df['tfp_relative'] = df['tfp'] / us['tfp'].iloc[0]\n", "\n", - "df.plot(x='tfp_relative', y='gdppc_relative', kind='scatter')\n", + "df.plot.scatter(x='tfp_relative', y='gdppc_relative')\n", "pass" ] }, @@ -1237,7 +1237,7 @@ "source": [ "df['factors_relative'] = df['factors'] / us['factors'].iloc[0]\n", "\n", - "df.plot(x='factors_relative', y='gdppc_relative', kind='scatter')\n", + "df.plot.scatter(x='factors_relative', y='gdppc_relative')\n", "pass" ] }, diff --git a/5b_Growth_Accounting.ipynb b/5b_Growth_Accounting.ipynb index 934eb9dd..daf967e5 100644 --- a/5b_Growth_Accounting.ipynb +++ b/5b_Growth_Accounting.ipynb @@ -497,7 +497,7 @@ "metadata": {}, "outputs": [], "source": [ - "df_growth.plot(y='gdppc', kind='hist',bins=15)\n", + "df_growth.plot.hist(y='gdppc', bins=15)\n", "pass" ] }, @@ -590,9 +590,7 @@ }, { "cell_type": "markdown", - "metadata": { - "jp-MarkdownHeadingCollapsed": true - }, + "metadata": {}, "source": [ "## 蓄積生産要素の成長率" ] @@ -632,7 +630,7 @@ "metadata": {}, "outputs": [], "source": [ - "df_growth.plot(y='factors', kind='hist',bins=15)\n", + "df_growth.plot.hist(y='factors', bins=15)\n", "pass" ] }, @@ -655,9 +653,7 @@ }, { "cell_type": "markdown", - "metadata": { - "jp-MarkdownHeadingCollapsed": true - }, + "metadata": {}, "source": [ "## 全要素生産性" ] @@ -695,7 +691,7 @@ "metadata": {}, "outputs": [], "source": [ - "df_growth.plot(y='tfp', kind='hist',bins=15)\n", + "df_growth.plot.hist(y='tfp', bins=15)\n", "pass" ] }, @@ -749,7 +745,7 @@ }, "outputs": [], "source": [ - "df_growth.plot(y=['tfp','factors'], kind='hist',bins=20,alpha=0.5)\n", + "df_growth.plot.hist(y=['tfp','factors'], bins=20, alpha=0.5)\n", "pass" ] }, @@ -1262,7 +1258,7 @@ }, "outputs": [], "source": [ - "df_jp.plot(y='gdppc_growth', kind='bar')\n", + "df_jp.plot.bar(y='gdppc_growth')\n", "pass" ] }, @@ -1286,7 +1282,7 @@ "outputs": [], "source": [ "cols = ['gdppc_growth', 'factors_growth', 'tfp_growth']\n", - "df_jp.plot(y=cols, kind='bar')\n", + "df_jp.plot.bar(y=cols)\n", "pass" ] }, @@ -1327,7 +1323,7 @@ }, "outputs": [], "source": [ - "df_jp.plot(y=cols[1:], kind='bar', stacked=True)\n", + "df_jp.plot.bar(y=cols[1:], stacked=True)\n", "pass" ] }, @@ -1349,7 +1345,7 @@ "outputs": [], "source": [ "ax_ = df_jp.plot(y=cols[0], marker='o',color='k', legend=True)\n", - "df_jp.plot(y=cols[1:], kind='bar', stacked=True, legend=True, ax=ax_)\n", + "df_jp.plot.bar(y=cols[1:], stacked=True, legend=True, ax=ax_)\n", "pass" ] }, diff --git a/6_Regression.ipynb b/6_Regression.ipynb index 3b99d158..6b6e6f69 100644 --- a/6_Regression.ipynb +++ b/6_Regression.ipynb @@ -41,7 +41,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "## はじめに" @@ -61,7 +62,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "## `Python`を使った回帰分析 " @@ -186,7 +188,7 @@ }, "outputs": [], "source": [ - "df2019.plot(x='tfp_relative', y='gdp_pc_relative', kind='scatter')\n", + "df2019.plot.scatter(x='tfp_relative', y='gdp_pc_relative')\n", "pass" ] }, @@ -194,8 +196,7 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true, - "jp-MarkdownHeadingCollapsed": true + "hidden": true }, "source": [ "### 回帰分析" @@ -643,7 +644,7 @@ }, "outputs": [], "source": [ - "ax_ = df2019.plot(x='tfp_relative', y='gdp_pc_relative', kind='scatter')\n", + "ax_ = df2019.plot.scatter(x='tfp_relative', y='gdp_pc_relative')\n", "df2019.sort_values('OLS fitted').plot(x='tfp_relative',\n", " y='OLS fitted',\n", " color='r', ax=ax_)\n", @@ -681,6 +682,7 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true, "tags": [ "remove-cell" ] @@ -692,7 +694,8 @@ { "cell_type": "markdown", "metadata": { - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "(sec:6-regression-da)=\n", @@ -704,7 +707,8 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true + "hidden": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "### 説明" diff --git a/7_DifferenceEq.ipynb b/7_DifferenceEq.ipynb index 401a8486..536946c8 100644 --- a/7_DifferenceEq.ipynb +++ b/7_DifferenceEq.ipynb @@ -38,7 +38,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "## はじめに" @@ -56,7 +57,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "## 1階差分方程式" @@ -588,7 +590,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "## 45度線モデル" @@ -740,7 +743,8 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true + "heading_collapsed": true, + "jp-MarkdownHeadingCollapsed": true }, "source": [ "## 蜘蛛の巣モデル" diff --git a/8_Solow.ipynb b/8_Solow.ipynb index 16ed8b81..7a882f9b 100644 --- a/8_Solow.ipynb +++ b/8_Solow.ipynb @@ -367,8 +367,7 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true, - "jp-MarkdownHeadingCollapsed": true + "heading_collapsed": true }, "source": [ "## 定常状態での変数の値" @@ -416,8 +415,7 @@ { "cell_type": "markdown", "metadata": { - "heading_collapsed": true, - "jp-MarkdownHeadingCollapsed": true + "heading_collapsed": true }, "source": [ "## 線形近似" @@ -427,8 +425,7 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true, - "jp-MarkdownHeadingCollapsed": true + "hidden": true }, "source": [ "### 説明" @@ -524,8 +521,7 @@ { "cell_type": "markdown", "metadata": { - "hidden": true, - "jp-MarkdownHeadingCollapsed": true + "hidden": true }, "source": [ "### $\\lambda$の解釈" @@ -600,8 +596,7 @@ "cell_type": "markdown", "metadata": { "heading_collapsed": true, - "hidden": true, - "jp-MarkdownHeadingCollapsed": true + "hidden": true }, "source": [ "### 線形近似による誤差" @@ -1442,8 +1437,7 @@ " \n", " df_tmp['Trend'] = res.fittedvalues #7\n", "\n", - " ax = df_tmp.plot(x=var, y='ky_ratio', #8\n", - " kind='scatter')\n", + " ax = df_tmp.plot.scatter(x=var, y='ky_ratio') #8\n", " \n", " df_tmp.sort_values('Trend').plot(x=var, #9\n", " y='Trend', \n", diff --git a/9_Convergence.ipynb b/9_Convergence.ipynb index d0f09163..3978bf51 100644 --- a/9_Convergence.ipynb +++ b/9_Convergence.ipynb @@ -205,9 +205,8 @@ "outputs": [], "source": [ "cond = ( pwt.loc[:,'year']==2019 )\n", - "pwt.loc[cond,'gdp_pc_log'].plot(kind='hist',\n", - " bins=20,\n", - " edgecolor='white')\n", + "pwt.loc[cond,'gdp_pc_log'].plot.hist(bins=20,\n", + " edgecolor='white')\n", "pass" ] }, @@ -231,13 +230,12 @@ "outputs": [], "source": [ "# 1 ヒストグラム\n", - "ax_ = pwt.loc[cond,'gdp_pc_log'].plot(kind='hist',\n", - " bins=20,\n", - " edgecolor='white',\n", - " density=True)\n", + "ax_ = pwt.loc[cond,'gdp_pc_log'].plot.hist(bins=20,\n", + " edgecolor='white',\n", + " density=True)\n", "\n", "# 2 密度関数\n", - "pwt.loc[cond,'gdp_pc_log'].plot(kind='density', ax=ax_)\n", + "pwt.loc[cond,'gdp_pc_log'].plot.density(ax=ax_)\n", "\n", "# 3 日本\n", "ax_.axvline(y_jp.iloc[0], color='red')\n", @@ -291,7 +289,7 @@ "\n", "for y, c in zip(yr_list, color_arr): # 3\n", " cond = ( pwt.loc[:,'year'] == y ) # 4\n", - " ax_ = pwt.loc[cond,'gdp_pc_log'].plot(kind='density', # 5\n", + " ax_ = pwt.loc[cond,'gdp_pc_log'].plot.density( # 5\n", " label=str(y), # 6\n", " legend=True, # 7\n", " color=str(c)) # 8\n", @@ -1433,8 +1431,8 @@ "source": [ "growth_avr = df_convergence.loc[:,'gdp_pc_growth'].mean() #1\n", "\n", - "ax = df_convergence.plot(y='gdp_pc_growth', kind='hist', #2\n", - " bins=25, edgecolor='k') #3\n", + "ax = df_convergence.plot.hist(y='gdp_pc_growth', #2\n", + " bins=25, edgecolor='k') #3\n", "ax.axvline(growth_avr, color='red') #4\n", "ax.set_ylabel('国の数', size=15) #5\n", "ax.set_title(\n", @@ -1558,9 +1556,8 @@ "df_convergence['fitted_absolute'] = res_absolute.fittedvalues\n", "\n", "# 図示\n", - "ax_ = df_convergence.plot(x='gdp_pc_init_log',\n", - " y='gdp_pc_growth',\n", - " kind='scatter')\n", + "ax_ = df_convergence.plot.scatter(x='gdp_pc_init_log',\n", + " y='gdp_pc_growth')\n", "df_convergence.sort_values('fitted_absolute') \\\n", " .plot(x='gdp_pc_init_log',\n", " y='fitted_absolute',\n",