{"id":1090495,"date":"2025-01-08T14:03:14","date_gmt":"2025-01-08T06:03:14","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1090495.html"},"modified":"2025-01-08T14:03:16","modified_gmt":"2025-01-08T06:03:16","slug":"%e5%a6%82%e4%bd%95%e6%8a%8a%e8%82%a1%e7%a5%a8%e6%95%b0%e6%8d%ae%e5%af%bc%e5%85%a5python-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1090495.html","title":{"rendered":"\u5982\u4f55\u628a\u80a1\u7968\u6570\u636e\u5bfc\u5165Python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24203126\/8b629063-cc18-4f44-924d-d5aa20196e30.webp\" alt=\"\u5982\u4f55\u628a\u80a1\u7968\u6570\u636e\u5bfc\u5165Python\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u628a\u80a1\u7968\u6570\u636e\u5bfc\u5165Python<\/strong><\/p>\n<\/p>\n<p><p>\u628a\u80a1\u7968\u6570\u636e\u5bfc\u5165Python\u7684\u4e3b\u8981\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528Pandas\u5e93\u3001\u5229\u7528Yahoo Finance API\u3001\u901a\u8fc7Alpha Vantage API\u3001\u501f\u52a9Quandl\u5e73\u53f0\u3001\u4f7f\u7528yfinance\u5e93\u7b49\u3002\u8fd9\u4e9b\u65b9\u6cd5\u5404\u6709\u4f18\u52a3\uff0c\u9002\u7528\u4e8e\u4e0d\u540c\u9700\u6c42\u3002<strong>\u5229\u7528Pandas\u5e93\u3001\u901a\u8fc7API\u83b7\u53d6\u3001\u4f7f\u7528Quandl\u5e73\u53f0\u3001\u7ed3\u5408yfinance\u5e93\u3001\u5bfc\u5165\u672c\u5730CSV\u6587\u4ef6<\/strong>\uff0c\u8fd9\u4e9b\u90fd\u662f\u5e38\u89c1\u4e14\u6709\u6548\u7684\u65b9\u6cd5\u3002\u5176\u4e2d\uff0c\u4f7f\u7528yfinance\u5e93\u662f\u4e00\u79cd\u975e\u5e38\u4fbf\u6377\u4e14\u529f\u80fd\u5f3a\u5927\u7684\u65b9\u6cd5\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u5feb\u901f\u83b7\u53d6\u80a1\u7968\u6570\u636e\u5e76\u76f4\u63a5\u5bfc\u5165\u5230Pandas\u6570\u636e\u6846\u4e2d\u3002<\/p>\n<\/p>\n<p><p>\u5177\u4f53\u6765\u8bf4\uff0cyfinance\u5e93\u662f\u57fa\u4e8eYahoo Finance API\u7684\u4e00\u4e2aPython\u5e93\uff0c\u80fd\u591f\u8f7b\u677e\u83b7\u53d6\u80a1\u7968\u3001\u671f\u6743\u3001\u6307\u6570\u7b49\u91d1\u878d\u6570\u636e\u3002\u5b83\u652f\u6301\u591a\u79cd\u6570\u636e\u7c7b\u578b\uff0c\u5305\u62ec\u5386\u53f2\u4ef7\u683c\u6570\u636e\u3001\u5b9e\u65f6\u4ef7\u683c\u6570\u636e\u3001\u80a1\u606f\u4fe1\u606f\u7b49\u3002\u6b64\u5916\uff0cyfinance\u5e93\u8fd8\u63d0\u4f9b\u4e86\u53cb\u597d\u7684API\u63a5\u53e3\uff0c\u4fbf\u4e8e\u7528\u6237\u5feb\u901f\u4e0a\u624b\u5e76\u8fdb\u884c\u6570\u636e\u5206\u6790\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\u5c06\u80a1\u7968\u6570\u636e\u5bfc\u5165Python\uff0c\u5e76\u7ed3\u5408\u5b9e\u9645\u6848\u4f8b\u8fdb\u884c\u6f14\u793a\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528Pandas\u5e93\u5bfc\u5165\u80a1\u7968\u6570\u636e<\/h3>\n<\/p>\n<p><p>Pandas\u662fPython\u4e2d\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u548c\u5206\u6790\u5e93\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u5904\u7406\u5404\u79cd\u6570\u636e\u683c\u5f0f\u3002\u8981\u4f7f\u7528Pandas\u5bfc\u5165\u80a1\u7968\u6570\u636e\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bfb\u53d6CSV\u6587\u4ef6\u3001Excel\u6587\u4ef6\u6216\u8005\u5176\u4ed6\u683c\u5f0f\u7684\u6587\u4ef6\u6765\u5b9e\u73b0\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u8bfb\u53d6CSV\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684CSV\u6587\u4ef6\u5305\u542b\u4e86\u80a1\u7968\u6570\u636e\uff0c\u901a\u5e38\u5305\u62ec\u65e5\u671f\u3001\u5f00\u76d8\u4ef7\u3001\u6536\u76d8\u4ef7\u3001\u6700\u9ad8\u4ef7\u3001\u6700\u4f4e\u4ef7\u548c\u6210\u4ea4\u91cf\u7b49\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u8bfb\u53d6CSV\u6587\u4ef6<\/strong><\/h2>\n<p>df = pd.read_csv(&#39;path_to_your_file.csv&#39;)<\/p>\n<h2><strong>\u6253\u5370\u6570\u636e\u6846\u7684\u524d\u51e0\u884c<\/strong><\/h2>\n<p>print(df.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u8bfb\u53d6Excel\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u7c7b\u4f3c\u5730\uff0cPandas\u4e5f\u53ef\u4ee5\u8f7b\u677e\u8bfb\u53d6Excel\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u8bfb\u53d6Excel\u6587\u4ef6<\/p>\n<p>df = pd.read_excel(&#39;path_to_your_file.xlsx&#39;)<\/p>\n<h2><strong>\u6253\u5370\u6570\u636e\u6846\u7684\u524d\u51e0\u884c<\/strong><\/h2>\n<p>print(df.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u5229\u7528Yahoo Finance API\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/h3>\n<\/p>\n<p><p>Yahoo Finance API\u662f\u4e00\u4e2a\u63d0\u4f9b\u91d1\u878d\u6570\u636e\u7684API\uff0c\u53ef\u4ee5\u7528\u4e8e\u83b7\u53d6\u5b9e\u65f6\u548c\u5386\u53f2\u80a1\u7968\u6570\u636e\u3002\u867d\u7136Yahoo Finance API\u5b98\u65b9\u5df2\u7ecf\u505c\u6b62\u7ef4\u62a4\uff0c\u4f46\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5e93\u6765\u8bbf\u95ee\u8fd9\u4e9b\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5yfinance\u5e93<\/h4>\n<\/p>\n<p><p>yfinance\u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u53d6Yahoo Finance\u7684\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install yfinance<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528yfinance\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import yfinance as yf<\/p>\n<h2><strong>\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/strong><\/h2>\n<p>ticker = yf.Ticker(&quot;AAPL&quot;)<\/p>\n<h2><strong>\u83b7\u53d6\u5386\u53f2\u6570\u636e<\/strong><\/h2>\n<p>hist = ticker.history(period=&quot;1mo&quot;)<\/p>\n<h2><strong>\u6253\u5370\u6570\u636e\u6846\u7684\u524d\u51e0\u884c<\/strong><\/h2>\n<p>print(hist.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u901a\u8fc7Alpha Vantage API\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/h3>\n<\/p>\n<p><p>Alpha Vantage\u662f\u53e6\u4e00\u4e2a\u63d0\u4f9b\u91d1\u878d\u6570\u636e\u7684API\uff0c\u7528\u6237\u9700\u8981\u6ce8\u518c\u83b7\u53d6\u4e00\u4e2aAPI\u5bc6\u94a5\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5alpha_vantage\u5e93<\/h4>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install alpha_vantage<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528Alpha Vantage\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">from alpha_vantage.timeseries import TimeSeries<\/p>\n<h2><strong>\u8f93\u5165\u4f60\u7684API\u5bc6\u94a5<\/strong><\/h2>\n<p>api_key = &#39;your_api_key&#39;<\/p>\n<h2><strong>\u521d\u59cb\u5316TimeSeries\u5bf9\u8c61<\/strong><\/h2>\n<p>ts = TimeSeries(key=api_key, output_format=&#39;pandas&#39;)<\/p>\n<h2><strong>\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/strong><\/h2>\n<p>data, meta_data = ts.get_intraday(symbol=&#39;AAPL&#39;, interval=&#39;1min&#39;, outputsize=&#39;full&#39;)<\/p>\n<h2><strong>\u6253\u5370\u6570\u636e\u6846\u7684\u524d\u51e0\u884c<\/strong><\/h2>\n<p>print(data.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u501f\u52a9Quandl\u5e73\u53f0\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/h3>\n<\/p>\n<p><p>Quandl\u662f\u4e00\u4e2a\u63d0\u4f9b\u5404\u79cd\u91d1\u878d\u6570\u636e\u7684\u5e73\u53f0\uff0c\u7528\u6237\u9700\u8981\u6ce8\u518c\u5e76\u83b7\u53d6\u4e00\u4e2aAPI\u5bc6\u94a5\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5Quandl\u5e93<\/h4>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install quandl<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u4f7f\u7528Quandl\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import quandl<\/p>\n<h2><strong>\u8f93\u5165\u4f60\u7684API\u5bc6\u94a5<\/strong><\/h2>\n<p>quandl.ApiConfig.api_key = &#39;your_api_key&#39;<\/p>\n<h2><strong>\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/strong><\/h2>\n<p>data = quandl.get(&#39;WIKI\/AAPL&#39;)<\/p>\n<h2><strong>\u6253\u5370\u6570\u636e\u6846\u7684\u524d\u51e0\u884c<\/strong><\/h2>\n<p>print(data.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u5bfc\u5165\u672c\u5730CSV\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u6709\u672c\u5730\u7684CSV\u6587\u4ef6\uff0c\u5305\u542b\u4e86\u80a1\u7968\u7684\u5386\u53f2\u6570\u636e\uff0c\u53ef\u4ee5\u76f4\u63a5\u7528Pandas\u8bfb\u53d6\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u8bfb\u53d6CSV\u6587\u4ef6<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<h2><strong>\u8bfb\u53d6CSV\u6587\u4ef6<\/strong><\/h2>\n<p>df = pd.read_csv(&#39;path_to_your_file.csv&#39;)<\/p>\n<h2><strong>\u6253\u5370\u6570\u636e\u6846\u7684\u524d\u51e0\u884c<\/strong><\/h2>\n<p>print(df.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u6570\u636e\u6e05\u6d17\u4e0e\u5904\u7406<\/h3>\n<\/p>\n<p><p>\u83b7\u53d6\u5230\u80a1\u7968\u6570\u636e\u540e\uff0c\u53ef\u80fd\u9700\u8981\u8fdb\u884c\u4e00\u4e9b\u6570\u636e\u6e05\u6d17\u548c\u5904\u7406\uff0c\u4ee5\u4fbf\u8fdb\u884c\u540e\u7eed\u5206\u6790\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5904\u7406\u7f3a\u5931\u503c<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u68c0\u67e5\u7f3a\u5931\u503c<\/p>\n<p>print(df.isnull().sum())<\/p>\n<h2><strong>\u5220\u9664\u5305\u542b\u7f3a\u5931\u503c\u7684\u884c<\/strong><\/h2>\n<p>df = df.dropna()<\/p>\n<h2><strong>\u6216\u8005\u7528\u7279\u5b9a\u503c\u586b\u5145\u7f3a\u5931\u503c<\/strong><\/h2>\n<p>df = df.fillna(method=&#39;ffill&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u6570\u636e\u7c7b\u578b\u8f6c\u6362<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u5c06\u65e5\u671f\u5217\u8f6c\u6362\u4e3a\u65e5\u671f\u7c7b\u578b<\/p>\n<p>df[&#39;Date&#39;] = pd.to_datetime(df[&#39;Date&#39;])<\/p>\n<h2><strong>\u68c0\u67e5\u6570\u636e\u7c7b\u578b<\/strong><\/h2>\n<p>print(df.dtypes)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u6570\u636e\u53ef\u89c6\u5316<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u66f4\u597d\u5730\u7406\u89e3\u80a1\u7968\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u53ef\u89c6\u5316\u5de5\u5177\uff0c\u5982Matplotlib\u548cSeaborn\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u5b89\u88c5Matplotlib\u548cSeaborn<\/h4>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install matplotlib seaborn<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u7ed8\u5236\u80a1\u7968\u4ef7\u683c\u66f2\u7ebf<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import seaborn as sns<\/p>\n<h2><strong>\u8bbe\u7f6e\u7ed8\u56fe\u98ce\u683c<\/strong><\/h2>\n<p>sns.set_style(&#39;whitegrid&#39;)<\/p>\n<h2><strong>\u7ed8\u5236\u6536\u76d8\u4ef7\u66f2\u7ebf<\/strong><\/h2>\n<p>plt.figure(figsize=(12, 6))<\/p>\n<p>plt.plot(df[&#39;Date&#39;], df[&#39;Close&#39;])<\/p>\n<p>plt.title(&#39;Stock Closing Prices&#39;)<\/p>\n<p>plt.xlabel(&#39;Date&#39;)<\/p>\n<p>plt.ylabel(&#39;Close Price&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516b\u3001\u5b9e\u6218\u6848\u4f8b<\/h3>\n<\/p>\n<p><p>\u4e0b\u9762\u6211\u4eec\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7684\u5b9e\u6218\u6848\u4f8b\u6765\u6f14\u793a\u5982\u4f55\u5c06\u80a1\u7968\u6570\u636e\u5bfc\u5165Python\uff0c\u5e76\u8fdb\u884c\u7b80\u5355\u7684\u5206\u6790\u548c\u53ef\u89c6\u5316\u3002<\/p>\n<\/p>\n<p><h4>1\u3001\u83b7\u53d6\u80a1\u7968\u6570\u636e<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528yfinance\u5e93\u83b7\u53d6\u82f9\u679c\u516c\u53f8\uff08AAPL\uff09\u7684\u80a1\u7968\u6570\u636e\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import yfinance as yf<\/p>\n<h2><strong>\u83b7\u53d6\u82f9\u679c\u516c\u53f8\u80a1\u7968\u6570\u636e<\/strong><\/h2>\n<p>ticker = yf.Ticker(&quot;AAPL&quot;)<\/p>\n<p>hist = ticker.history(period=&quot;1y&quot;)<\/p>\n<h2><strong>\u6253\u5370\u6570\u636e\u6846\u7684\u524d\u51e0\u884c<\/strong><\/h2>\n<p>print(hist.head())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2\u3001\u6570\u636e\u6e05\u6d17\u4e0e\u5904\u7406<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\"># \u68c0\u67e5\u7f3a\u5931\u503c<\/p>\n<p>print(hist.isnull().sum())<\/p>\n<h2><strong>\u586b\u5145\u7f3a\u5931\u503c<\/strong><\/h2>\n<p>hist = hist.fillna(method=&#39;ffill&#39;)<\/p>\n<h2><strong>\u68c0\u67e5\u6570\u636e\u7c7b\u578b<\/strong><\/h2>\n<p>print(hist.dtypes)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3\u3001\u6570\u636e\u53ef\u89c6\u5316<\/h4>\n<\/p>\n<p><pre><code class=\"language-python\">import matplotlib.pyplot as plt<\/p>\n<p>import seaborn as sns<\/p>\n<h2><strong>\u8bbe\u7f6e\u7ed8\u56fe\u98ce\u683c<\/strong><\/h2>\n<p>sns.set_style(&#39;whitegrid&#39;)<\/p>\n<h2><strong>\u7ed8\u5236\u6536\u76d8\u4ef7\u66f2\u7ebf<\/strong><\/h2>\n<p>plt.figure(figsize=(12, 6))<\/p>\n<p>plt.plot(hist.index, hist[&#39;Close&#39;])<\/p>\n<p>plt.title(&#39;AAPL Stock Closing Prices&#39;)<\/p>\n<p>plt.xlabel(&#39;Date&#39;)<\/p>\n<p>plt.ylabel(&#39;Close Price&#39;)<\/p>\n<p>plt.show()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e5d\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u5c06\u80a1\u7968\u6570\u636e\u5bfc\u5165Python\uff0c\u4e3b\u8981\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528Pandas\u5e93\u3001\u5229\u7528Yahoo Finance API\u3001\u901a\u8fc7Alpha Vantage API\u3001\u501f\u52a9Quandl\u5e73\u53f0\u3001\u4f7f\u7528yfinance\u5e93\u7b49\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u4f18\u70b9\u548c\u9002\u7528\u573a\u666f\uff0c\u7528\u6237\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u3002\u6b64\u5916\uff0c\u672c\u6587\u8fd8\u4ecb\u7ecd\u4e86\u6570\u636e\u6e05\u6d17\u4e0e\u5904\u7406\u4ee5\u53ca\u6570\u636e\u53ef\u89c6\u5316\u7684\u57fa\u672c\u64cd\u4f5c\uff0c\u901a\u8fc7\u4e00\u4e2a\u5b9e\u6218\u6848\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u5c06\u80a1\u7968\u6570\u636e\u5bfc\u5165Python\u5e76\u8fdb\u884c\u7b80\u5355\u7684\u5206\u6790\u548c\u53ef\u89c6\u5316\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Python\u4e2d\u83b7\u53d6\u5b9e\u65f6\u80a1\u7968\u6570\u636e\uff1f<\/strong><br \/>\u5728Python\u4e2d\u83b7\u53d6\u5b9e\u65f6\u80a1\u7968\u6570\u636e\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u6d41\u884c\u7684\u5e93\uff0c\u4f8b\u5982<code>yfinance<\/code>\u548c<code>Alpha Vantage<\/code>\u3002<code>yfinance<\/code>\u5e93\u5141\u8bb8\u7528\u6237\u8f7b\u677e\u8bbf\u95eeYahoo Finance\u7684\u6570\u636e\uff0c\u53ea\u9700\u5b89\u88c5\u5e93\u5e76\u4f7f\u7528\u76f8\u5e94\u7684API\u5373\u53ef\u3002\u901a\u8fc7\u7b80\u5355\u7684\u4ee3\u7801\uff0c\u53ef\u4ee5\u83b7\u53d6\u7279\u5b9a\u80a1\u7968\u7684\u5b9e\u65f6\u4ef7\u683c\u3001\u5386\u53f2\u6570\u636e\u4ee5\u53ca\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\u3002\u6b64\u5916\uff0c<code>Alpha Vantage<\/code>\u63d0\u4f9b\u4e86\u514d\u8d39\u7684API\u5bc6\u94a5\uff0c\u901a\u8fc7\u8be5\u5bc6\u94a5\uff0c\u7528\u6237\u53ef\u4ee5\u83b7\u53d6\u5b9e\u65f6\u80a1\u7968\u6570\u636e\u548c\u591a\u79cd\u6280\u672f\u6307\u6807\uff0c\u9002\u5408\u8fdb\u884c\u66f4\u590d\u6742\u7684\u5206\u6790\u3002<\/p>\n<p><strong>\u5bfc\u5165\u80a1\u7968\u6570\u636e\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u4e8b\u9879\uff1f<\/strong><br \/>\u5728\u5bfc\u5165\u80a1\u7968\u6570\u636e\u65f6\uff0c\u7528\u6237\u5e94\u5173\u6ce8\u6570\u636e\u7684\u51c6\u786e\u6027\u548c\u66f4\u65b0\u9891\u7387\u3002\u786e\u4fdd\u4f7f\u7528\u7684\u6570\u636e\u6e90\u53ef\u9760\uff0c\u907f\u514d\u56e0\u6570\u636e\u5ef6\u8fdf\u6216\u9519\u8bef\u5bfc\u81f4\u7684\u5206\u6790\u5931\u8bef\u3002\u6b64\u5916\uff0c\u4e86\u89e3\u6570\u636e\u7684\u65f6\u95f4\u8303\u56f4\u3001\u9891\u7387\uff08\u5982\u65e5\u3001\u5468\u3001\u6708\uff09\u53ca\u5176\u683c\u5f0f\u4e5f\u662f\u81f3\u5173\u91cd\u8981\u7684\u3002\u7528\u6237\u8fd8\u5e94\u8003\u8651\u6570\u636e\u7684\u6e05\u6d17\u548c\u9884\u5904\u7406\uff0c\u786e\u4fdd\u53ef\u4ee5\u987a\u5229\u8fdb\u884c\u540e\u7eed\u7684\u5206\u6790\u548c\u53ef\u89c6\u5316\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5904\u7406\u80a1\u7968\u6570\u636e\u7684\u5e38\u7528\u5e93\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>Python\u4e2d\u6709\u591a\u79cd\u5e93\u53ef\u7528\u4e8e\u5904\u7406\u80a1\u7968\u6570\u636e\uff0c\u5176\u4e2d<code>pandas<\/code>\u662f\u6700\u5e38\u7528\u7684\u6570\u636e\u5904\u7406\u5e93\uff0c\u80fd\u591f\u9ad8\u6548\u5730\u5904\u7406\u548c\u5206\u6790\u6570\u636e\u6846\u3002<code>matplotlib<\/code>\u548c<code>seaborn<\/code>\u662f\u5e38\u7528\u7684\u53ef\u89c6\u5316\u5e93\uff0c\u80fd\u591f\u5e2e\u52a9\u7528\u6237\u5c06\u80a1\u7968\u6570\u636e\u53ef\u89c6\u5316\uff0c\u4fbf\u4e8e\u7406\u89e3\u8d8b\u52bf\u3002\u5176\u4ed6\u5e93\u5982<code>NumPy<\/code>\u548c<code>statsmodels<\/code>\u4e5f\u5e38\u7528\u4e8e\u6570\u503c\u8ba1\u7b97\u548c\u7edf\u8ba1\u5206\u6790\uff0c\u80fd\u591f\u4e3a\u7528\u6237\u63d0\u4f9b\u5f3a\u5927\u7684\u6570\u636e\u5206\u6790\u80fd\u529b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u628a\u80a1\u7968\u6570\u636e\u5bfc\u5165Python \u628a\u80a1\u7968\u6570\u636e\u5bfc\u5165Python\u7684\u4e3b\u8981\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528Pandas\u5e93\u3001\u5229\u7528Yahoo F [&hellip;]","protected":false},"author":3,"featured_media":1090502,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1090495"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1090495"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1090495\/revisions"}],"predecessor-version":[{"id":1090505,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1090495\/revisions\/1090505"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1090502"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1090495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1090495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1090495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}