Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import csv
- import os
- from datetime import datetime
- import random as rnd
- import pandas as pd
- files_dir = os.path.join(os.path.dirname(__file__), 'CSV_FILE')
- questions = ["A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10", "A11", "A12", "B1", "B2", "B3", "B4", "B5",
- "B6", "B7", "B8", "B9", "B10", "B11", "B12", "C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8", "C9", "C10",
- "C11", "C12", "D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8", "D9", "D10", "D11", "D12", "E1", "E2", "E3",
- "E4", "E5", "E6", "E7", "E8", "E9", "E10", "E11", "E12", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8",
- "F9", "F10", "F11", "F12", "SRPR", "SR01", "SR02", "SR03", "SR04", "SR05", "SR06", "SR07", "SR08", "SR09",
- "SR10", "SR11", "SR12", "SR13", "SR14", "SR15", "MRPR", "MR01", "MR02", "MR03", "MR04", "MR05", "MR06",
- "MR07", "MR08", "MR09", "MR10", "MR11", "MR12", "MR13", "MR14", "MR15", "MR16", "PFPR", "PF01", "PF02",
- "PF03", "PF04", "PF05", "PF06", "PF07", "PF08", "PF09", "PF10", "PF11", "PF12", "PF13", "PF14", "PF15",
- "PAPR", "PA01", "PA02", "PA03", "PA04", "PA05", "PA06", "PA07", "PA08", "PA09", "PA10", "PA11", "PA12",
- "PA13", "PA14", "PA15"]
- data = pd.read_csv(os.path.join(files_dir, 'result.csv'))
- min_times = {}
- max_times = {}
- cleared_data = data.dropna()
- for question in questions:
- min_times[question] = cleared_data[question].min()
- max_times[question] = cleared_data[question].max()
- generated_row_count = 1_000_000
- with open(os.path.join(files_dir, 'results2.csv'), 'w') as f:
- writer = csv.DictWriter(f, fieldnames=questions)
- writer.writeheader()
- for i in range(generated_row_count):
- generated_times = {}
- for question in questions:
- generated_times[question] = rnd.randint(min_times[question], max_times[question])
- writer.writerow(generated_times)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement