Skip to content

Commit

Permalink
Python files for final cleanup
Browse files Browse the repository at this point in the history
Consists of code to merge with weather data. Just basic touch ups and code cleaning for final set.
  • Loading branch information
aashishdugar authored Dec 9, 2018
1 parent d0360e9 commit 7216ca5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
45 changes: 45 additions & 0 deletions source_code/nyc-taxi/python/DataMerge1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import os
import sys
import datetime

f1 = open("/home/ad4025/rbda/project/part2/part3/part4/part5/newweatherdata")
f2 = open("/home/ad4025/rbda/project/part2/part3/part4/part5/final_netflow.txt")

x1 = f1.readlines()
x2 = f2.readlines()
for a1 in x1:
a_1 = a1.split(";")
date = a_1[0]
for a2 in x2:
a_2 = a2.split(";")
if date==a_2[0]:
#print(a2+";"+a_1[1]+";"+a_1[2]+";"+a_1[3]+";"+a_1[4]+";"+a_1[5]+";"+a_1[6]+";"+a_1[7]+";"+a_1[8]+";"+a_1[9]+";"+a_1[10]+";"+a_1[11]+";"+a_1[12]+";"+a_1[13])
print(a2+a1[11:])
f3 = open("/home/ad4025/rbda/project/part2/part3/part4/part5/netflow_weather.txt","a")
f3.write(str(a2).strip()+str(a1[11:]));
f3.close();
else:
continue
#f3 = open("/home/ad4025/rbda/project/part2/part3/part4/part5/business_weather.txt","a")
#f3.write(a2);
#f3.close();




















16 changes: 16 additions & 0 deletions source_code/nyc-taxi/python/JoinWeather.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
import sys
import datetime

f1 = open("/home/ad4025/rbda/project/part2/part3/part4/part5/part6/business_weather.txt")

x1 = f1.readlines()

for a in x1:
a1 = a.split(";")
datetime1 = a1[0] +" "+a1[1]
datetime2 = a1[2] +" "+a1[3]
print(datetime1+";"+datetime2+a[33:])
f3 = open("/home/ad4025/rbda/project/part2/part3/part4/part5/part6/business_weather2.txt","a")
f3.write(datetime1+";"+datetime2+a[33:]);
f3.close();

0 comments on commit 7216ca5

Please sign in to comment.