本文整理汇总了Python中pandas.io.data.DataReader.sort方法的典型用法代码示例。如果您正苦于以下问题:Python DataReader.sort方法的具体用法?Python DataReader.sort怎么用?Python DataReader.sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.io.data.DataReader
的用法示例。
在下文中一共展示了DataReader.sort方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: len
# 需要导入模块: from pandas.io.data import DataReader [as 别名]
# 或者: from pandas.io.data.DataReader import sort [as 别名]
goog["EMA5"] = talib.EMA(goog["Close"], 5) #64
goog["EMA10"] = talib.EMA(goog["Close"], 10) #65
goog["EMA15"] = talib.EMA(goog["Close"], 15) #66
goog["EMA20"] = talib.EMA(goog["Close"], 20) #67
goog["EMA50"] = talib.EMA(goog["Close"], 50) #68
goog["EMA100"] = talib.EMA(goog["Close"], 100) #69
goog["EMA200"] = talib.EMA(goog["Close"], 200) #72
goog["maxopen"] = talib.max(goog["open"], 60) #72
goog["maxclose"] = talib.max(goog["Close"], 60) #72
goog["maxhigh"] = talib.max(goog["high"], 60) #72
goog["maxlow"] = talib.max(goog["low"], 60) #72
goog["maxvol"] = talib.max(goog["volume"], 60) #72
rev_goog = goog.sort(ascending=0)
rev_goog2 = rev_goog[:2500]#.to_string()
counter = 0
#for quote in rev_goog2:
for quote in rev_goog2.itertuples():
if counter > 0:
#print len(quote)
#for i in range(0, len(quote)):
# print quote[i]
#print quote
sql3 = "INSERT INTO `stock`.`stock_new` (`ticker`, `qdate`, `open`, `high`, `low`, `close`, `volume`, `adj_Close`, `NDC`, `close_1`, `close_2`, `close_3`, `close_4`, `close_5`, `close_6`, `close_7`, `close_8`, `close_9`, `close_10`, `Open_1`, `Open_2`, `Open_3`, `Open_4`, `Open_5`, `Open_6`, `Open_7`, `Open_8`, `Open_9`, `Open_10`, `High_1`, `High_2`, `High_3`, `High_4`, `High_5`, `High_6`, `High_7`, `High_8`, `High_9`, `High_10`, `Low_1`, `Low_2`,`Low_3`, `Low_4`, `Low_5`, `Low_6`, `Low_7`, `Low_8`, `Low_9`, `Low_10`, `Volume_1`, `Volume_2`, `Volume_3`, `Volume_4`, `Volume_5`, `Volume_6`, `Volume_7`, `Volume_8`, `Volume_9`, `Volume_10`, `SMA5`, `SMA10`, `SMA15`, `SMA20`, `SMA50`, `sMA100`, `SMA200`, `EMA5`, `EMA10`, `EMA15`, `EMA20`, `EMA50`, `EMA100`, `EMA200`) VALUES ("
sql3 = sql3 + "\"" + str(ticker[0])
sql3 = sql3 + "\", \"" + str(quote[0]) + "\""
#sql3 = sql3 + ", " + str(quote[1]) + ", " + str(quote[2]) + ", " + str(quote[3]) + ", " + str(quote[4]) + ", " + str(quote[5]) + ", " + str(quote[6]) + ", " + str(quote[7]) + ", " + str(quote[8]) + ", " + str(quote[9]) + ", " + str(quote[10]) + ", " + str(quote[11]) + ", " + str(quote[12]) + ", " + str(quote[13]) + ", " + str(quote[14]) + ", " + str(quote[15]) + ", " + str(quote[16]) + ", " + str(quote[17]) + ", " + str(quote[18]) + ", " + str(quote[19]) + ", " + str(quote[20]) + ", " + str(quote[21]) + ", " + str(quote[22]) + ", " + str(quote[23]) + ", " + str(quote[24]) + ", " + str(quote[25]) + ", " + str(quote[26]) + ", " + str(quote[27]) + ", " + str(quote[28]) + ", " + str(quote[29]) + ", " + str(quote[30]) + ", " + str(quote[31]) + ", " + str(quote[32]) + ", " + str(quote[33]) + ", " + str(quote[34]) + ", " + str(quote[35]) + ", " + str(quote[36]) + ", " + str(quote[37]) + ", " + str(quote[38]) + ", " + str(quote[39]) + ", " + str(quote[40]) + ", " + str(quote[41]) + ", " + str(quote[42]) + ", " + str(quote[43]) + ", " + str(quote[44]) + ", " + str(quote[45]) + ", " + str(quote[46]) + ", " + str(quote[47]) + ", " + str(quote[48]) + ", " + str(quote[49]) + ", " + str(quote[50]) + ", " + str(quote[51]) + ", " + str(quote[52]) + ", " + str(quote[53]) + ", " + str(quote[54]) + ", " + str(quote[55]) + ", " + str(quote[56]) + ", " + str(quote[57]) + ", " + str(quote[58]) + ", " + str(quote[59]) + ", " + str(quote[60]) + ", " + str(quote[61]) + ", " + str(quote[62]) + ", " + str(quote[63]) + ", " + str(quote[64]) + ", " + str(quote[65]) + ", " + str(quote[66]) + ", " + str(quote[67]) + ", " + str(quote[68]) + ", " + str(quote[69]) + ", " + str(quote[70]) + ", " + str(quote[71])+ ")"
for x in range(1,71):
示例2: str
# 需要导入模块: from pandas.io.data import DataReader [as 别名]
# 或者: from pandas.io.data.DataReader import sort [as 别名]
if tick_val < 0:
text = str(int(tick_val)).replace("-", "Romney+")
else:
text = "Obama+"+str(int(tick_val))
return text
# <codecell>
from pandas import lib
from matplotlib.ticker import FuncFormatter
fig, axes = plt.subplots(figsize=(12,8))
data = group[["poll_date", "obama_spread"]]
data = pandas.concat((data, national_data2012[["poll_date", "obama_spread"]]))
data.sort("poll_date", inplace=True)
dates = pandas.DatetimeIndex(data.poll_date).asi8
loess_res = sm.nonparametric.lowess(data.obama_spread.values, dates,
frac=.2, it=3)
dates_x = lib.ints_to_pydatetime(dates)
axes.scatter(dates_x, data["obama_spread"])
axes.plot(dates_x, loess_res[:,1], color='r')
axes.yaxis.get_major_locator().set_params(nbins=12)
axes.yaxis.set_major_formatter(FuncFormatter(edit_tick_label))
axes.grid(False, axis='x')
axes.hlines(0, dates_x[0], dates_x[-1], color='black', lw=3)
axes.margins(0, .05)
# <codecell>