import pandas as pd from tqdm import tqdm import numpy as np #r = pd.read_csv('../train/expected.tsv', header = None,sep='\t') years = list() with tqdm(open('../train/expected.tsv'), total=1_000_000) as f_in: for line in f_in: y_min, y_max = line.rstrip().split(',') years.append(float(y_min)) years.append(float(y_max)) mean = np.mean(years) mean = str(mean) #mean = str(float(r.mean())) print('mean: ' + mean) with open('../dev-0/out.tsv','w') as f_out, open('../dev-0/in.tsv', 'r') as f_in: for line in f_in: f_out.write(mean + '\n') with open('../test-A/out.tsv','w') as f_out, open('../test-A/in.tsv', 'r') as f_in: for line in f_in: f_out.write(mean + '\n') # test