Example #1
0
        parser = argparse.ArgumentParser(
           description='Reads one argument -t (TYPE (e.g csv , json , api ))')
        parser.add_argument('-t', '--input_file_type', action='store',default = "csv",
                                           help='FILE TYPE.')
        args = parser.parse_args()
        return args 

        
        
if __name__ == '__main__':
   # v_args = GetArgs() 
   # v_input_file_type = v_args.input_file_type
    
    v_input_file_type = "csv"
    # Import Data : class get_data
    obj_get_data = getdata()
    source_df = obj_get_data.ReadCSVData()
    
    # Transformation : class transformation 
    
    obj_transformation = Transformation(source_df)
    obj_transformation.set_time_readable()
    obj_transformation.set_medium_source_path()
    top_source_medium_df = obj_transformation.final_dataframe()
    #v_name = top_source_medium_df.
    print(top_source_medium_df)
    distinctusers_batch = obj_transformation.execute_metrics(10000)  
    print(distinctusers_batch) 
    distinctusers_day = obj_transformation.calc_distinctusers_perday()
    print(distinctusers_day)
    
Example #2
0
def main():
    X, Y = getdata()
    print(len(X))
    model = ann(200)
    model.fit(X, Y)
    print(model.score(X, Y))
Example #3
0
        position.append((y2,x2))
        extreme.append(h_extreme2)

    return position,extreme

if __name__ == "__main__":

    data = read()  # 读取全部数据

    # 根据风场设置假定中心点 , 滤波前,由500hPa风场确定的大致中心位置,m是纬度,n是经度
    m = 32;n=86  
    p0 = (m,n)
    d = 0.25

    # 取得想要的初始范围内的数据,y纬度,x经度, 初始范围内的位势高度场和涡度场
    height, vorticity= getdata(data,m,n,d)  
    h40,h45,h50,h55 = height
    vo40,vo45,vo50,vo55 = vorticity

    # 迭代过程中的一系列位置
    ps_h40,exh40 = pos_height(vo55,m,n,d)
    ps_h45,exh45 = pos_height(h45,m,n,d)
    ps_h50,exh50 = pos_height(h50,m,n,d)
    ps_h55,exh55 = pos_height(h55,m,n,d)

    ps_vo40,exvo40 = pos_vorticity(vo40,m,n,d)
    ps_vo45,exvo45 = pos_vorticity(vo45,m,n,d)
    ps_vo50,exvo50 = pos_vorticity(vo50,m,n,d)
    ps_vo55,exvo55 = pos_vorticity(vo55,m,n,d)

    print(ps_h40,exh40)
Example #4
0
# -*- coding: utf-8 -*-
# @Time : 2020/3/16 11:07
# @Author : 永
# @File : MovingAverage.py
# @Software: PyCharm

import numpy as np
import pandas as pd
from get_data import getdata
import talib
import cgitb
# 这句放在所有程序开始前,这样就可以正常打印异常了
cgitb.enable(format="text")
df = getdata()


def movingaverage(l, N):
    sum = 0
    result = list(0 for x in l)
    for i in range(0, N):
        sum = sum + l[i]
        result[i] = sum / (i + 1)
    for i in range(N, len(l)):
        sum = sum - l[i - N] + l[i]
        result[i] = sum / N
    return result


def rsiFunc(prices, n=14):
    deltas = np.diff(prices)
    seed = deltas[:n + 1]
Example #5
0
        position.append((y2,x2))
        extreme.append(h_extreme2)

    return position,extreme

if __name__ == "__main__":

    data = read()  # 读取全部数据

# 第0步,根据风场假定中心点
    # 根据风场设置假定中心点
    m = 32;n=86   # 滤波前,由500hPa风场确定的大致中心位置,m是纬度,n是经度
    p0 = (m,n)
    d = 0.25
    # 初始范围内的位势高度场和涡度场
    height, vorticity= getdata(data,m,n,d)  # 取得想要的初始范围内的数据,y纬度,x经度
    h40,h45,h50,h55 = height
    vo40,vo45,vo50,vo55 = vorticity
    # ps0 = pos(data0)

    # 迭代过程中的一系列位置
    ps_h40,exh40 = pos_height(vo55,m,n,d)
    ps_h45,exh45 = pos_height(h45,m,n,d)
    ps_h50,exh50 = pos_height(h50,m,n,d)
    ps_h55,exh55 = pos_height(h55,m,n,d)

    ps_vo40,exvo40 = pos_vorticity(vo40,m,n,d)
    ps_vo45,exvo45 = pos_vorticity(vo45,m,n,d)
    ps_vo50,exvo50 = pos_vorticity(vo50,m,n,d)
    ps_vo55,exvo55 = pos_vorticity(vo55,m,n,d)