def loadData(data_dir, stock_index): df1 = pd.read_csv( os.path.join(data_dir, stock_index, stock_index + "_2020_3.csv")) df2 = pd.read_csv( os.path.join(data_dir, stock_index, stock_index + "_2020_4.csv")) df1 = pd.concat([df1, df2]) df1.columns = setColname().day_history_wangyi() return df1
def loadData(): data_dir = data_dict.get("JiGouDiaoYan") tmp_data_dir = tmp_data_dict.get("JiGouDiaoYan") cols = setColname().jigoudiaoyan() data_file = os.path.join(tmp_data_dir,"all_JiGouDiaoYan.csv") df = pd.read_csv(data_file, \ error_bad_lines=False,header=None,sep=",") df.columns = cols df.to_csv(data_file,index=0) return df
import pandas as pd from davidyu_cfg import * from functions.colNames import setColname data_dir = "day_history_wangyi" file_in = os.path.join(tmp_data_dict.get(data_dir), data_dir + ".csv") #data_file = os.path.join(file_in,header=None) df1 = pd.read_csv(file_in, header=None) df1 = df1.drop_duplicates() df1.columns = setColname().day_history_wangyi() df2 = df1[df1["stock_date"] >= "1997-01-01"] df2.to_csv(file_in, index=0)
from davidyu_cfg import * from functions.data_dir import data_dict, stk_index_list, create_dir_if_not_exist from functions.colNames import setColname data_file = os.path.join(tmp_data_dict.get("JiGouDiaoYan"), "jigoudiaoyan.csv") df1 = pd.read_csv(data_file, error_bad_lines=False) cols = setColname().jigoudiaoyan() df1.columns = cols df1.rename(columns={"date": "stock_date"}, inplace=True) df2 = df1[df1[df1.columns[3]] != df1.columns[3]] df2 = df2[df2["ChangePercent"] != "stock_date"] df2.to_csv(data_file, index=0, header=None)
from davidyu_cfg import * from functions.data_dir import * from functions.colNames import setColname data_dir = tmp_data_dict.get("bankuai") data_file = os.path.join(data_dir, "bankuai.csv") df1 = pd.read_csv(data_file) df1.columns = setColname().bankuai() df1.to_csv(data_file, index=0, header=None)
return self def reset_columns(self, sum_col_list): self.SUM_COLUMNS = sum_col_list return self if __name__ == '__main__': now_date, now_date_time = get_the_datetime( ) ## the now_date is like "2019_11_08" now_date = "2020_06_12" dir_dadan = data_dict.get("DADAN") data_dir = os.path.join(dir_dadan, now_date) print(data_dir) df1 = combine_csv_in_folder(data_dir) df1.columns = setColname().DADAN() #aa = DaDanAna(df1).df_out #aa = DaDanAna(df1).max_min().dadan_diff_stat().df_out #print(aa.head(10)) ''' dadan sale total money ''' df_merge = DaDanAna(df1).dadan_diff_stat() df_merge1 = df_merge.df_out df_merge.dadan_diff_stat_print() #print(df_merge1.head(50)) #print(df_merge1.tail(30)) #df_merge2 = df_merge1[df_merge1.sale_num.isna()] #df_merge3 = df_merge2.sort_values("buy_num",ascending=False) #df1.to_csv("DADAN_sample.csv",index=0)