-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreateRandom.py
More file actions
29 lines (24 loc) · 875 Bytes
/
createRandom.py
File metadata and controls
29 lines (24 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import random
import pandas as pd
from datetime import datetime
from datetime import timedelta
def createRandomData(min, max, step, amount):
df = pd.DataFrame()
randomData =[]
randomDate =[]
randomTime =[]
for i in range(amount):
randomHR = random.randrange(min, max, step)
randomData.append(randomHR)
time_str = '23/2/2020 11:12:22.234513'
date_format_str = '%d/%m/%Y %H:%M:%S.%f'
given_time = datetime.strptime(time_str, date_format_str)
final_time = given_time + timedelta(hours=i)
randomDate.append(final_time.date())
randomTime.append(final_time.strftime('%H:%M:%S'))
df["Heartrate"] = randomData
df["Start_Date"] = randomDate
df["Start_Time"] = randomTime
with open("random.csv", 'w') as f:
df.to_csv(f)
# createRandomData(60, 100, 2, 500)