We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef1c723 commit 04f3788Copy full SHA for 04f3788
Tutorials/Quandl Script.py
@@ -0,0 +1,20 @@
1
+# import needed libraries
2
+import quandl
3
+import pandas as pd
4
+
5
+# add quandl API key for unrestricted
6
+quandl.ApiConfig.api_key = 'INSERT YOU API KEY HERE'
7
8
+# get the table for daily stock prices and,
9
+# filter the table for selected tickers, columns within a time range
10
+# set paginate to True because Quandl limits tables API to 10,000 rows per call
11
+data = quandl.get_table('WIKI/PRICES', ticker = ['AAPL', 'MSFT', 'WMT'],
12
+ qopts = { 'columns': ['ticker', 'date', 'adj_close'] },
13
+ date = { 'gte': '2015年12月31日', 'lte': '2016年12月31日' },
14
+ paginate=True)
15
16
+# create a new dataframe with 'date' column as index
17
+new = data.set_index('date')
18
19
+# use pandas pivot function to sort adj_close by tickers
20
+clean_data = new.pivot(columns='ticker')
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments