{"id":4787,"date":"2022-07-31T22:12:58","date_gmt":"2022-07-31T14:12:58","guid":{"rendered":"https:\/\/seit2019.xyz\/?p=4787"},"modified":"2022-11-14T14:36:58","modified_gmt":"2022-11-14T06:36:58","slug":"5-1-%e8%ae%a1%e9%87%8f%e5%88%86%e6%9e%901%ef%bc%9agdp%e5%a2%9e%e9%95%bf%e7%8e%87","status":"publish","type":"post","link":"https:\/\/seit2019.xyz\/?p=4787","title":{"rendered":"5.1 \u8ba1\u91cf\u5206\u67901\uff1aGDP\u589e\u957f\u7387"},"content":{"rendered":"<h3>5.1.0 \u8981\u70b9<\/h3>\n<ul>\n<li>\n<p>Python\u57fa\u672c\u64cd\u4f5c<\/p>\n<ul>\n<li><code>print()<\/code>\u51fd\u6570<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Pandas\u7a0b\u5e8f\u5305<\/p>\n<ul>\n<li>\n<p>\u6570\u636e\u5e8f\u5217\u7684\u57fa\u672c\u8fd0\u7b97<\/p>\n<pre><code>.add()     # \u52a0\n.sub()     # \u51cf\n.mul()     # \u4e58\n.div()     # \u9664\n.pow()     # \u6307\u6570<\/code><\/pre>\n<\/li>\n<li>\n<p>\u6570\u636e\u5e8f\u5217\u7684\u5dee\u5206\u4e0e\u5e73\u79fb\uff1a\u4e00\u9636\u5dee\u5206<code>.diff(1)<\/code> \uff0c\u6570\u636e\u5e73\u79fb<code>.shift(1)<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>Matplotlib\u7a0b\u5e8f\u5305<\/p>\n<ul>\n<li>\u7ed8\u5236\u6298\u7ebf\u56fe\uff1a<code>plt.plot()<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<h3>5.1.1 \u9898\u76ee<\/h3>\n<p>\u6839\u636e\u56fd\u5bb6\u7edf\u8ba1\u5c40\u516c\u5e03\u7684<strong>\u300a\u4e2d\u56fd\u7edf\u8ba1\u5e74\u92742021\u300b<\/strong>\uff08<a href=\"http:\/\/www.stats.gov.cn\/tjsj\/ndsj\/2021\/indexch.htm\">\u70b9\u51fb\u6253\u5f00<\/a>\uff09\uff0c\u67e5\u8be2\u4e2d\u56fd1978-2020\u5e74(\u6309\u5f53\u5e74\u4ef7\u683c\u8ba1\u7b97)\u56fd\u5185\u751f\u4ea7\u603b\u503c\uff08GDP\uff09,\u4ee5\u53ca\u56fd\u5185\u751f\u4ea7\u603b\u503c\u6307\u6570\uff081978\u5e74=100\uff09\uff0c\u7136\u540e\u8ba1\u7b97\u5e76\u753b\u56fe\u5c55\u793a\uff1a<\/p>\n<ul>\n<li>1978-2020\u5e74\u5b9e\u9645\u56fd\u5185\u751f\u4ea7\u603b\u503c\uff081978\u5e74=100\uff09\uff1b<\/li>\n<li>1979-2020\u5e74\u6bcf\u5e74\u5b9e\u9645\u56fd\u5185\u751f\u4ea7\u603b\u503c\u7684\u589e\u957f\u7387\uff1b<\/li>\n<li>\u4e2d\u56fd1979-2020\u5e74\u5b9e\u9645\u56fd\u5185\u751f\u4ea7\u603b\u503c\u7684\u5e73\u5747\u589e\u957f\u7387\uff0c\u4ee5\u53ca\u5bf9\u5e94\u7684\u6807\u51c6\u5dee\u3002<\/li>\n<\/ul>\n<p><strong>\u64cd\u4f5c\u63d0\u793a<\/strong><\/p>\n<pre><code>1.\u6536\u96c6\u6570\u636e\uff1a\u300a\u4e2d\u56fd\u7edf\u8ba1\u5e74\u92742021\u300b\u88683-1\uff0c\u88683-5\uff0c\u624b\u52a8\u8f93\u5165excel\u6587\u4ef6\n\n2.\u8ba1\u7b97\u5b9e\u9645GDP\u516c\u5f0f\uff1a\uff08\u6309\u5f53\u5e74\u4ef7\u683c\u8ba1\u7b97\u7684\uff09\u56fd\u5185\u751f\u4ea7\u603b\u503c\/\u56fd\u5185\u751f\u4ea7\u603b\u503c\u6307\u6570\uff081978=100\uff09*100\n\n3.\u8ba1\u7b97\u5b9e\u9645GDP\u589e\u957f\u7387\u516c\u5f0f\uff1a(\u5f53\u5e74\u5b9e\u9645GDP-\u4e0a\u5e74\u5b9e\u9645GDP)\/\u4e0a\u5e74\u5b9e\u9645GDP*100<\/code><\/pre>\n<hr \/>\n<h3>5.1.2 \u4ee3\u7801<\/h3>\n<pre><code class=\"language-python\"># \u5bfc\u5165\u7a0b\u5e8f\u5305\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport ssl\n\n# \u7981\u7528SSL\u8bc1\u4e66\u6821\u9a8c\nssl._create_default_https_context = ssl._create_unverified_context\n\n# \u5bfc\u5165\u6570\u636e(\u5728\u7ebf\u6570\u636e)\ndf = pd.read_excel(r&#039;https:\/\/cdn.seit2019.xyz\/data\/econometrics\/GDP.xlsx&#039;)\n\n# \u5c55\u793a\u6570\u636e\nprint(df, &quot;\\n&quot;)\n\n# \u5b9a\u4e49\u6570\u636e\u5e8f\u5217\ngdp = df[&quot;\u56fd\u5185\u751f\u4ea7\u603b\u503c(\u5f53\u5e74\u4ef7\u683c\uff0c\u4ebf\u5143\uff09&quot;]\ngdp_index = df[&quot;GDP\u6307\u6570(1978=100)&quot;]\n\n# \u8ba1\u7b97\u5b9e\u9645GDP\n# .div()\u5e8f\u5217\u76f8\u9664\nreal_gdp = gdp.div(gdp_index.div(100))\nprint(&quot;\u5b9e\u9645GDP\u5e8f\u5217:&quot;)\nprint(real_gdp, &quot;\\n&quot;)\n\n# \u8ba1\u7b97\u5b9e\u9645GDP\u589e\u957f\u7387\n# .diff(1)\u4e00\u9636\u5dee\u5206\n# .shift(1)\u884c\u6570\u636e\u5411\u4e0b\u5e73\u79fb\u4e00\u683c\uff0c\u6ede\u540e\u4e00\u9636\nreal_gdp_added = real_gdp.diff(1)\nreal_gdp_shift = real_gdp.shift(1)\ngrowth = real_gdp_added.div(real_gdp_shift)\nprint(&quot;\u5b9e\u9645GDP\u589e\u957f\u7387\uff1a&quot;)\nprint(growth, &quot;\\n&quot;)\n\n# \u8ba1\u7b97\u5e73\u5747\u589e\u957f\u7387\u548c\u6807\u51c6\u5dee\ngrowth_mean = growth.mean()\ngrowth_std = growth.std()\nprint(&quot;\u5e73\u5747\u589e\u957f\u7387\u4e3a\uff1a&quot;)\nprint(growth_mean.round(5), &quot;\\n&quot;)\nprint(&quot;\u5e73\u5747\u589e\u957f\u7387\u7684\u6807\u51c6\u5dee\u4e3a\uff1a&quot;)\nprint(growth_std.round(5), &quot;\\n&quot;)\n\n# \u7ed8\u56fe\uff1a\u8bbe\u7f6e\u7ed8\u56fe\u683c\u5f0f,\u652f\u6301\u6c49\u5b57\nplt.rcParams[&#039;font.sans-serif&#039;] = [&#039;SimHei&#039;]\nplt.rcParams[&#039;axes.unicode_minus&#039;] = False\n\n# \u7ed8\u56fe\uff1a\u5b9a\u4e49\u53d8\u91cf\nx = df[&quot;\u5e74\u5ea6&quot;]\ny1 = gdp.div(10000)\ny2 = real_gdp.div(10000)\ny3 = growth\n\n# \u7ed8\u56fe\uff1a\u540d\u4e49GDP\nplt.plot(x, y1, c=&#039;blue&#039;)\nplt.title(&#039;\u4e2d\u56fd1978-2021\u5e74\u540d\u4e49GDP\uff08\u5355\u4f4d\uff1a\u4e07\u4ebf\u5143\uff09&#039;, fontsize=&#039;xx-large&#039;, fontweight=&#039;bold&#039;)\nplt.show()\n\n# \u7ed8\u56fe\uff1a\u5b9e\u9645GDP\nplt.plot(x, y2, c=&#039;green&#039;)\nplt.title(&#039;\u4e2d\u56fd1978-2021\u5b9e\u9645GDP\uff081978=100\uff0c\u5355\u4f4d\uff1a\u4e07\u4ebf\u5143\uff09&#039;, fontsize=&#039;xx-large&#039;, fontweight=&#039;bold&#039;)\nplt.show()\n\n# \u7ed8\u56fe\uff1a\u5b9e\u9645GDP\u589e\u957f\u7387\nplt.plot(x, y3, c=&#039;black&#039;)\nplt.title(&#039;\u4e2d\u56fd1978-2021\u5e74\u5b9e\u9645GDP\u589e\u957f\u7387&#039;, fontsize=&#039;xx-large&#039;, fontweight=&#039;bold&#039;)\nplt.show()<\/code><\/pre>\n<hr \/>\n<h3>5.1.3 \u4ee3\u7801\u89e3\u6790<\/h3>\n<p><strong>\u5bfc\u5165\u7a0b\u5e8f\u5305<\/strong><\/p>\n<pre><code class=\"language-python\">import pandas as pd\nimport matplotlib.pyplot as plt<\/code><\/pre>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>pandas<\/code>\uff1aPython\u6570\u636e\u5904\u7406\u6700\u5e38\u7528\u7684\u7a0b\u5e8f\u5305<\/li>\n<li><code>matplotlib<\/code>\uff1aPython\u7ed8\u56fe\u5e38\u7528\u7a0b\u5e8f\u5305<\/li>\n<li><code>import pandas as pd<\/code>\uff1a\u8868\u793a\u5c06pandas\u7a0b\u5e8f\u5305\u5bfc\u5165\uff0c\u5e76\u7b80\u5316\u547d\u540d\u4e3a\uff1a<code>pd<\/code><\/li>\n<li><code>import matplotlib.pyplot as plt<\/code>\uff1a\u8868\u793a\u5c06<code>matplotlib<\/code>\u7a0b\u5e8f\u5305\u4e2d\u7684<code>pyplot<\/code>\u6a21\u5757\u5bfc\u5165\uff0c\u5e76\u7b80\u5316\u547d\u540d\u4e3a\uff1a<code>plt<\/code><\/li>\n<li>\u4e0a\u8ff0\u7a0b\u5e8f\u5305\u5bfc\u5165\u548c\u7b80\u5316\u547d\u540d\u65b9\u5f0f\uff0c\u662fPython\u7f16\u7a0b\u901a\u7528\u7684\u65b9\u5f0f\u3002\u4e3a\u4e86\u4fbf\u4e8e\u4ee3\u7801\u9605\u8bfb\u548c\u5206\u4eab\uff0c\u5efa\u8bae\u4fdd\u6301\u4e0d\u53d8\u3002<\/li>\n<\/ul>\n<p><strong>\u5bfc\u5165\u6570\u636e<\/strong><\/p>\n<pre><code class=\"language-python\">df = pd.read_excel(r&#039;https:\/\/cdn.seit2019.xyz\/data\/econometrics\/GDP.xlsx&#039;)<\/code><\/pre>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li>\u529f\u80fd\uff1a\u8c03\u7528<code>pandas<\/code>\u7a0b\u5e8f\u5305\u4e2d\u7684<code>read_excel()<\/code>\u51fd\u6570\uff0c\u5c06\u94fe\u63a5\u4e2d\u6570\u636e\u5bfc\u5165\uff0c\u5e76\u547d\u540d\u4e3a\u53d8\u91cf<code>df<\/code><\/li>\n<li>\u53d8\u91cf<code>df<\/code>\u4e2d\uff0c\u6570\u636e\u4ee5DataFrame\u683c\u5f0f\u5b58\u50a8\u6570\u636e\u3002<\/li>\n<li>DataFrame\u662fpandas\u652f\u6301\u7684\u8868\u683c\u578b\u6570\u636e\u683c\u5f0f\uff0c\u7c7b\u4f3cexcel\u3002<\/li>\n<li>\u5173\u4e8eDataFrame\uff0c\u8be6\u60c5\u53c2\u8003\uff1a<a href=\"https:\/\/www.runoob.com\/pandas\/pandas-dataframe.html\">Pandas \u6570\u636e\u7ed3\u6784 &#8211; DataFrame<\/a><\/li>\n<li>\u4e3a\u4e86\u4fbf\u4e8e\u6559\u7a0b\u5206\u4eab\uff0c\u8fd9\u91cc\u91c7\u7528\u5728\u7ebf\u6570\u636e\u3002<\/li>\n<li>\u8be6\u7ec6\u7684\u6570\u636e\u5bfc\u5165\u4e0e\u5bfc\u51fa\uff0c\u8bf7\u53c2\u8003\uff1a<a href=\"https:\/\/seit2019.xyz\/?p=4778\">2.2 Python\u6570\u636e\u5bfc\u5165\u4e0e\u5bfc\u51fa<\/a><\/li>\n<\/ul>\n<p><strong>\u5c55\u793a\u6570\u636e<\/strong><\/p>\n<pre><code class=\"language-python\">print(df, &quot;\\n&quot;)<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/cdn.seit2019.xyz\/pic\/python\/5.1_lec01_01.png?w=750&#038;ssl=1\" alt=\"\u539f\u59cb\u6570\u636e\" \/><\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li>\u529f\u80fd\uff1a\u663e\u793a\u540d\u79f0\u4e3a<code>df<\/code>\u7684\u53d8\u91cf\uff0c\u7136\u540e\u56de\u8f66\uff0c\u6362\u884c\u3002<\/li>\n<li><code>print()<\/code>\u662fpython\u663e\u793a\u8f93\u51fa\u51fd\u6570\uff0c\u53ef\u4ee5\u5c06\u53d8\u91cf\uff0c\u6570\u636e\uff0c\u8fd0\u884c\u7ed3\u679c\u7b49\u4ee5\u6587\u672c\u7684\u65b9\u5f0f\u663e\u793a\u5728\u7a0b\u5e8f\u8fd0\u884c\u7a97\u53e3\u3002<\/li>\n<li><code>\u201d\\n&quot;<\/code>\uff1a\u8868\u793a\u56de\u8f66\u3001\u6362\u884c\uff0c\u5176\u529f\u80fd\u662f\uff1a\u5c06\u524d\u540e\u4e24\u6b21\u663e\u793a\u7684\u7ed3\u679c\u4ee5\u7a7a\u884c\u9694\u5f00\u3002<\/li>\n<\/ul>\n<p><strong>\u5b9a\u4e49\u6570\u636e\u5e8f\u5217<\/strong><\/p>\n<pre><code class=\"language-python\">gdp = df[&quot;\u56fd\u5185\u751f\u4ea7\u603b\u503c(\u5f53\u5e74\u4ef7\u683c\uff0c\u4ebf\u5143\uff09&quot;]\ngdp_index = df[&quot;GDP\u6307\u6570(1978=100)&quot;]<\/code><\/pre>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li>\u5c06\u53d8\u91cf<code>df<\/code>\u4e2d\u540d\u79f0\u4e3a<code>\u201c\u56fd\u5185\u751f\u4ea7\u603b\u503c(\u5f53\u5e74\u4ef7\u683c\uff0c\u4ebf\u5143\uff09\u201d<\/code>\u7684\u5217\uff0c\u8d4b\u503c\u7ed9\u53d8\u91cf<code>gdp<\/code><\/li>\n<li>\u5c06\u53d8\u91cf<code>df<\/code>\u4e2d\u540d\u79f0\u4e3a<code>\u201cGDP\u6307\u6570(1978=100)\u201d<\/code>\u7684\u5217\uff0c\u8d4b\u503c\u7ed9\u53d8\u91cf<code>gdp_index<\/code><\/li>\n<\/ul>\n<p><strong>\u8ba1\u7b97\u5b9e\u9645GDP<\/strong><\/p>\n<pre><code class=\"language-python\">real_gdp = gdp.div(gdp_index.div(100))\nprint(&quot;\u5b9e\u9645GDP\u5e8f\u5217:&quot;)\nprint(real_gdp, &quot;\\n&quot;)<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/cdn.seit2019.xyz\/pic\/python\/5.1_lec01_02.png?w=750&#038;ssl=1\" alt=\"\u5b9e\u9645GDP\u5e8f\u5217\" \/><\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>.div()<\/code>\uff1a\u5e8f\u5217\u9664\u4ee5\uff08\uff09\u4e2d\u7684\u53d8\u91cf\u6216\u6570\u503c\u3002<\/li>\n<li><code>pandas<\/code>\u4e2d\u5e38\u7528\u5e8f\u5217\u8ba1\u7b97\uff1a\u52a0<code>.add()<\/code>\uff0c\u51cf<code>.sub()<\/code>\uff0c\u4e58 <code>.mul()<\/code> \uff0c\u9664 <code>.div()<\/code>\uff0c\u6307\u6570\u5e42<code>.pow()<\/code><\/li>\n<li>\u66f4\u591a\u5e8f\u5217\u8ba1\u7b97\uff0c\u8bf7\u53c2\u8003\uff1a<a href=\"https:\/\/www.gairuo.com\/p\/pandas-computations\">pandas \u6c42\u503c\u8ba1\u7b97<\/a><\/li>\n<li><code>gdp_index.div(100)<\/code>\uff1a<code>gdp_index<\/code>\u5e8f\u5217\u9664\u4ee5100<\/li>\n<\/ul>\n<p><strong>\u8ba1\u7b97\u5b9e\u9645GDP\u589e\u957f\u7387<\/strong><\/p>\n<pre><code class=\"language-python\">real_gdp_added = real_gdp.diff(1)\nreal_gdp_shift = real_gdp.shift(1)\ngrowth = real_gdp_added.div(real_gdp_shift)\nprint(&quot;\u5b9e\u9645GDP\u589e\u957f\u7387\uff1a&quot;)\nprint(growth, &quot;\\n&quot;)<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/cdn.seit2019.xyz\/pic\/python\/5.1_lec01_03.png?w=750&#038;ssl=1\" alt=\"\u5b9e\u9645GDP\u589e\u957f\u7387\" \/><\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>.diff(1)<\/code>\uff1a\u5bf9\u5e8f\u5217\u8fdb\u884c\u4e00\u9636\u5dee\u5206<\/li>\n<li><code>.shift(1)<\/code>\uff1a\u5c06\u884c\u6570\u636e\u5411\u4e0b\u5e73\u79fb\u4e00\u683c\uff0c\u5373\u6ede\u540e\u4e00\u9636<\/li>\n<\/ul>\n<p><strong>\u8ba1\u7b97\u5e73\u5747\u589e\u957f\u7387\u548c\u6807\u51c6\u5dee<\/strong><\/p>\n<pre><code class=\"language-python\">growth_mean = growth.mean()\ngrowth_std = growth.std()\nprint(&quot;\u5e73\u5747\u589e\u957f\u7387\u4e3a\uff1a&quot;)\nprint(growth_mean.round(5), &quot;\\n&quot;)\nprint(&quot;\u5e73\u5747\u589e\u957f\u7387\u7684\u6807\u51c6\u5dee\u4e3a\uff1a&quot;)\nprint(growth_std.round(5), &quot;\\n&quot;)<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/cdn.seit2019.xyz\/pic\/python\/5.1_lec01_04.png?w=750&#038;ssl=1\" alt=\"\u5b9e\u9645GDP\u589e\u957f\u7387\u548c\u6807\u51c6\u5dee\" \/><\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>.mean()<\/code>\uff1a\u8ba1\u7b97\u5e8f\u5217\u7684\u5747\u503c<\/li>\n<li><code>.std()<\/code>\uff1a\u8ba1\u7b97\u5e8f\u5217\u7684\u6807\u51c6\u5dee<\/li>\n<li><code>.round(5)<\/code>\uff1a\u53d8\u91cf\u53d6\u503c\u4fdd\u7559\u5c0f\u6570\u70b9\u540e5\u4f4d<\/li>\n<\/ul>\n<p><strong>\u7ed8\u56fe\uff1a\u8bbe\u7f6e\u7ed8\u56fe\u683c\u5f0f\uff0c\u652f\u6301\u6c49\u5b57<\/strong><\/p>\n<pre><code class=\"language-python\">plt.rcParams[&#039;font.sans-serif&#039;] = [&#039;SimHei&#039;]\nplt.rcParams[&#039;axes.unicode_minus&#039;] = False<\/code><\/pre>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>Matplotlib<\/code>\u9ed8\u8ba4\u4e0d\u652f\u6301\u4e2d\u6587\u3002<\/li>\n<li>\u5982\u679c\u9700\u8981\u5728\u56fe\u5f62\u4e2d\u663e\u793a\u4e2d\u6587\u5b57\u7b26\uff0c\u8bf7\u5728\u7ed8\u56fe\u524d\u52a0\u5165\u4e0a\u8ff0\u4ee3\u7801\u3002<\/li>\n<\/ul>\n<p><strong>\u7ed8\u56fe\uff1a\u5b9a\u4e49\u53d8\u91cf<\/strong><\/p>\n<pre><code class=\"language-python\">x = df[&quot;\u5e74\u5ea6&quot;]\ny1 = gdp.div(10000)\ny2 = real_gdp.div(10000)\ny3 = growth<\/code><\/pre>\n<p>\u8bf4\u660e\uff1a\u540d\u4e49GDP\u548c\u5b9e\u9645GDP\u9664\u4ee510000\uff0c\u5c06\u539f\u5355\u4f4d\u201c\u4ebf\u5143\u201d\u8f6c\u6362\u4e3a\u201c\u4e07\u4ebf\u5143\u201d\u3002<\/p>\n<p><strong>\u7ed8\u56fe\uff1a\u540d\u4e49GDP<\/strong><\/p>\n<pre><code class=\"language-python\">plt.plot(x, y1, c=&#039;blue&#039;)\nplt.title(&#039;\u4e2d\u56fd1978-2021\u5e74\u540d\u4e49GDP\uff08\u5355\u4f4d\uff1a\u4e07\u4ebf\u5143\uff09&#039;, fontsize=&#039;xx-large&#039;, fontweight=&#039;bold&#039;)\nplt.show()<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/cdn.seit2019.xyz\/pic\/python\/5.1_lec01_05.png?w=750&#038;ssl=1\" alt=\"\u540d\u4e49GDP\" \/><\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>plt.plot()<\/code>\uff1a\u8c03\u7528<code>plt<\/code>\u4e2d<code>plot()<\/code>\u51fd\u6570\uff0c\u7ed8\u5236\u6298\u7ebf\u56fe<\/li>\n<li><code>c=&#039;blue&#039;<\/code>\uff1a\u8bbe\u7f6e\u6298\u7ebf\u989c\u8272\u4e3a\u84dd\u8272<\/li>\n<li><code>plt.title()<\/code>\uff1a\u8c03\u7528<code>plt<\/code>\u4e2d<code>title()<\/code>\u51fd\u6570\uff0c\u8bbe\u7f6e\u56fe\u5f62\u7684\u6807\u9898<\/li>\n<li><code>fontsize=&#039;xx-large&#039;<\/code>\uff1a\u8bbe\u7f6e\u6807\u9898\u5b57\u53f7\u3002\u5176\u4ed6\u5b57\u53f7\uff1a<code>&#039;large&#039;<\/code>, <code>&#039;x-large&#039;<\/code><\/li>\n<li><code>fontweight=&#039;bold&#039;<\/code>\uff1a\u8bbe\u7f6e\u6807\u9898\u5b57\u53f7\u52a0\u7c97<\/li>\n<\/ul>\n<p><strong>\u7ed8\u56fe\uff1a\u5b9e\u9645GDP<\/strong><\/p>\n<pre><code class=\"language-python\">plt.plot(x, y2, c=&#039;green&#039;)\nplt.title(&#039;\u4e2d\u56fd1978-2021\u5b9e\u9645GDP\uff081978=100\uff0c\u5355\u4f4d\uff1a\u4e07\u4ebf\u5143\uff09&#039;, fontsize=&#039;xx-large&#039;, fontweight=&#039;bold&#039;)\nplt.show()<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/cdn.seit2019.xyz\/pic\/python\/5.1_lec01_06.png?w=750&#038;ssl=1\" alt=\"\u5b9e\u9645GDP\" \/><\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>plt.plot()<\/code>\uff1a\u8c03\u7528<code>plt<\/code>\u4e2d<code>plot()<\/code>\u51fd\u6570\uff0c\u7ed8\u5236\u6298\u7ebf\u56fe<\/li>\n<li><code>c=&#039;green&#039;<\/code>\uff1a\u8bbe\u7f6e\u6298\u7ebf\u989c\u8272\u4e3a\u7eff\u8272<\/li>\n<li><code>plt.title()<\/code>\uff1a\u8c03\u7528<code>plt<\/code>\u4e2d<code>title()<\/code>\u51fd\u6570\uff0c\u8bbe\u7f6e\u56fe\u5f62\u7684\u6807\u9898<\/li>\n<li><code>fontsize=&#039;xx-large&#039;<\/code>\uff1a\u8bbe\u7f6e\u6807\u9898\u5b57\u53f7\u3002\u5176\u4ed6\u5b57\u53f7\uff1a<code>&#039;large&#039;<\/code>, <code>&#039;x-large&#039;<\/code><\/li>\n<li><code>fontweight=&#039;bold&#039;<\/code>\uff1a\u8bbe\u7f6e\u6807\u9898\u5b57\u53f7\u52a0\u7c97<\/li>\n<\/ul>\n<p><strong>\u7ed8\u56fe\uff1a\u5b9e\u9645GDP\u589e\u957f\u7387<\/strong><\/p>\n<pre><code class=\"language-python\">plt.plot(x, y3, c=&#039;black&#039;)\nplt.title(&#039;\u4e2d\u56fd1978-2021\u5e74\u5b9e\u9645GDP\u589e\u957f\u7387&#039;, fontsize=&#039;xx-large&#039;, fontweight=&#039;bold&#039;)\nplt.show()<\/code><\/pre>\n<p>\u8fd0\u884c\u7ed3\u679c\uff1a<\/p>\n<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/cdn.seit2019.xyz\/pic\/python\/5.1_lec01_07.png?w=750&#038;ssl=1\" alt=\"\u5b9e\u9645GDP\u589e\u957f\u7387\" \/><\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<ul>\n<li><code>plt.plot()<\/code>\uff1a\u8c03\u7528<code>plt<\/code>\u4e2d<code>plot()<\/code>\u51fd\u6570\uff0c\u7ed8\u5236\u6298\u7ebf\u56fe<\/li>\n<li><code>c=&#039;black&#039;<\/code>\uff1a\u8bbe\u7f6e\u6298\u7ebf\u989c\u8272\u4e3a\u9ed1\u8272<\/li>\n<li><code>plt.title()<\/code>\uff1a\u8c03\u7528<code>plt<\/code>\u4e2d<code>title()<\/code>\u51fd\u6570\uff0c\u8bbe\u7f6e\u56fe\u5f62\u7684\u6807\u9898<\/li>\n<li><code>fontsize=&#039;xx-large&#039;<\/code>\uff1a\u8bbe\u7f6e\u6807\u9898\u5b57\u53f7\u3002\u5176\u4ed6\u5b57\u53f7\uff1a<code>&#039;large&#039;<\/code>, <code>&#039;x-large&#039;<\/code><\/li>\n<li><code>fontweight=&#039;bold&#039;<\/code>\uff1a\u8bbe\u7f6e\u6807\u9898\u5b57\u53f7\u52a0\u7c97<\/li>\n<\/ul>\n<hr \/>\n<h3>\u53c2\u8003<\/h3>\n<ul>\n<li><a href=\"https:\/\/www.gairuo.com\/p\/pandas-computations\">pandas \u6c42\u503c\u8ba1\u7b97<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>5.1.0 \u8981\u70b9 Python\u57fa\u672c\u64cd\u4f5c print()\u51fd\u6570 Pandas\u7a0b\u5e8f\u5305 \u6570\u636e\u5e8f\u5217\u7684\u57fa\u672c\u8fd0\u7b97  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29,30],"tags":[],"class_list":["post-4787","post","type-post","status-publish","format-standard","hentry","category-29","category-30"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/seit2019.xyz\/index.php?rest_route=\/wp\/v2\/posts\/4787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seit2019.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seit2019.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seit2019.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seit2019.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4787"}],"version-history":[{"count":0,"href":"https:\/\/seit2019.xyz\/index.php?rest_route=\/wp\/v2\/posts\/4787\/revisions"}],"wp:attachment":[{"href":"https:\/\/seit2019.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seit2019.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seit2019.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}