forked from herbertli/NYC-Transit-and-Weather
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consists of code to merge with weather data. Just basic touch ups and code cleaning for final set.
- Loading branch information
1 parent
d0360e9
commit 7216ca5
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |