forked from GeetikaSi/Pre-process
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdata_conversion.py
More file actions
50 lines (34 loc) · 1.09 KB
/
data_conversion.py
File metadata and controls
50 lines (34 loc) · 1.09 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Created on 6/9/22
@author: qinyuzhu
"""
import pandas as pd
from datetime import datetime, timedelta
def type_conversion():
"""Function that do data type conversion for time features
Parameters
----------
column name of the time feature in the file as the parameter of the funtion named type_conversion
Returns
-------
a new csv file with one new column of the converted start time
Raises
------
Exception
raise exception when the initial time (ini_time) is not set or the format of initial time is not '%b %d %Y %I:%M%p'
raise exception when the output csv file name is not written
"""
df = pd.read_csv("")
lst = []
for date in df:
new = datetime.strptime(date, '')
df["new_date"] = datetime.strftime()
ini_time = ""
ini_time_for_now = datetime.strptime(ini_time, '%b %d %Y %I:%M%p')
lst=[]
new_final_time = ini_time_for_now + timedelta(days=1)
difference = new_final_time - ini_time_for_now
lst.append(difference)
lst.to_csv("")
if __name__ == '__main__':
pass