Beispiel #1
0
def readcsv(datafile='tmp-fe-normdiflog.csv'):
    '''Read CSV file.'''
    try:
        if datafile.endswith('.gz'):
            df = readfile(datafile, compress='gzip')
        else:
            df = readfile(datafile)
        return df
    except Exception:
        raise ValueError("Improper or non-existent datafile specified.")
Beispiel #2
0
def test_bootstrap_fecon236_Read_CSV_file():
    '''Read CSV file then check values.'''
    df = fred.readfile('tests' + sep + 'zdata-xau-13hj-c30.csv')
    #         readfile disregards XAU column name:
    assert [col for col in df.columns] == ['Y']
    assert df.shape == (30, 1)
    return df
Beispiel #3
0
def GET_simu_spx_pcent():
    '''Retrieve normalized SPX daily percent change 1957-2014.'''
    #           NORMALIZED s.t. sample mean=0 and std=1%.
    datafile = 'SIMU-mn0-sd1pc-d4spx_1957-2014.csv.gz'
    try:
        df = readfile(datafile, compress='gzip')
        #  print(' ::  Import success: ' + datafile)
    except Exception:
        df = 0
        print(' !!  Failed to find: ' + datafile)
    return df