当前位置: 首页>>代码示例>>Python>>正文


Python DataLoader.load方法代码示例

本文整理汇总了Python中DataLoader.load方法的典型用法代码示例。如果您正苦于以下问题:Python DataLoader.load方法的具体用法?Python DataLoader.load怎么用?Python DataLoader.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataLoader的用法示例。


在下文中一共展示了DataLoader.load方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_distance

# 需要导入模块: import DataLoader [as 别名]
# 或者: from DataLoader import load [as 别名]
def get_distance(directory) :
    '''returns the distance in m'''
    file = directory + '/info.dat'
    info = dl.load(file)[0]
    distancestr = info['Distance']
    distance = 0.01*float(distancestr.replace('cm',''))
    return distance
开发者ID:fillchen,项目名称:litoralis-synchronization,代码行数:9,代码来源:simple-plot-transferfunction-date.py

示例2: create_filename

# 需要导入模块: import DataLoader [as 别名]
# 或者: from DataLoader import load [as 别名]
def create_filename(directory, num=1) :
    """
    creates basic name for a file containing condition and distance information.
    Use num to assign numbers if more than one file per distance will be created
    """
    file = directory + '/info.dat'
    info = dl.load(file)[0]
    distancestr = info['Distance']
    conditionstr= info['Condition']
    speciesName = 'Pholidoptera_littoralis_'
    return speciesName+conditionstr+'_'+distancestr+'_'+str(num)
开发者ID:fillchen,项目名称:litoralis-synchronization,代码行数:13,代码来源:song-analysis.py

示例3: memory

# 需要导入模块: import DataLoader [as 别名]
# 或者: from DataLoader import load [as 别名]
###MAIN LOGIC
#get all stock symbols by reading csv names from data folder
symbols = []
#symbols = ['IVV','EEM','EFA','LQD','IYR','SHY','IEF','TIP']
symbols = ['VTI','EWJ','RWX','IEF','TLT','IAU','DBC','VGK','VNQ','VWO'] #quantopian list


allDfs = {}
#store all in memory (a dict of dfs). read from binary, if doesn't exist read from csv (and save binary)
for symbol in symbols:
    if datetime.now().day in [31,1,2]:
        forceDownload=True
    else:
        forceDownload=False
    df= DataLoader.load(symbol,forceDownload=forceDownload)
    shifted_dates = [(date+DateOffset(days=0)) for date in df.index] #shift dates to test path dependency
    df.index = shifted_dates
    allDfs[symbol] = df

#pdb.set_trace()
allClose = {}
#calculate rets
for symbol in symbols:
    price = allDfs[symbol]['Adj Close']
    prev_price = price.shift(1)
    ret = price/prev_price-1
    ret = Series(ret,index=price.index)
    df=DataFrame({'RET':ret})
    df2=DataFrame({'CLOSE':price})
    allDfs[symbol] = df
开发者ID:florentchandelier,项目名称:adaptiveassetallocation_python,代码行数:32,代码来源:laa_backtest_yhoo_gc.py

示例4: memory

# 需要导入模块: import DataLoader [as 别名]
# 或者: from DataLoader import load [as 别名]
    return performance_stats,cumrets, weights_df


###MAIN LOGIC
#get all stock symbols by reading csv names from data folder
symbols = []
#symbols = ['IVV','EEM','EFA','LQD','IYR','SHY','IEF','TIP']
#symbols = ['VTI','EWJ','RWX','IEF','TLT','IAU','DBC','VGK','VNQ','VWO'] #quantopian list
symbols = ['QRAAX','FDIVX','VTSMX','VGSIX','VFISX','VEIEX','VBMFX'] #mutual fund list


allDfs = {}
#store all in memory (a dict of dfs). read from binary, if doesn't exist read from csv (and save binary)
for symbol in symbols:
    df= DataLoader.load(symbol)
    shifted_dates = [(date+DateOffset(days=0)) for date in df.index] #shift dates to test path dependency
    df.index = shifted_dates
    allDfs[symbol] = df

#pdb.set_trace()
allClose = {}
#calculate rets
for symbol in symbols:
    price = allDfs[symbol]['Adj Close']
    prev_price = price.shift(1)
    ret = price/prev_price-1
    ret = Series(ret,index=price.index)
    df=DataFrame({'RET':ret})
    df2=DataFrame({'CLOSE':price})
    allDfs[symbol] = df
开发者ID:fiftyeggs,项目名称:noonecaneatfiftyeggs,代码行数:32,代码来源:laa_backtest_mf_gc.py

示例5: memory

# 需要导入模块: import DataLoader [as 别名]
# 或者: from DataLoader import load [as 别名]
    performance_stats['maxdd']=1-min(cumrets/cumrets.cummax())

    return performance_stats,cumrets, weights_df


###MAIN LOGIC
#get all stock symbols by reading csv names from data folder
symbols = []
#symbols = ['IVV','EEM','EFA','LQD','IYR','SHY','IEF','TIP']
symbols = ['VTI','EWJ','RWX','IEF','TLT','IAU','DBC','VGK','VNQ','VWO'] #quantopian list


allDfs = {}
#store all in memory (a dict of dfs). read from binary, if doesn't exist read from csv (and save binary)
for symbol in symbols:
    df= DataLoader.load(symbol,'20050101')
    shifted_dates = [(date+DateOffset(days=0)) for date in df.index] #shift dates to test path dependency
    df.index = shifted_dates
    allDfs[symbol] = df

#pdb.set_trace()

#calculate rets
for symbol in symbols:
	price = allDfs[symbol]['Adj Close']
	prev_price = price.shift(1)
	ret = price/prev_price-1
	ret = Series(ret,index=price.index)
	df=DataFrame({'RET':ret})
	allDfs[symbol]=df
	#pdb.set_trace()
开发者ID:florentchandelier,项目名称:adaptiveassetallocation_python,代码行数:33,代码来源:laa_backtest_yhoo.py


注:本文中的DataLoader.load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。