Skip to content

Commit

Permalink
added miovision data and another testing file
Browse files Browse the repository at this point in the history
  • Loading branch information
Li-Evelyn committed Mar 28, 2020
1 parent 45bb161 commit 38e6826
Show file tree
Hide file tree
Showing 19 changed files with 1,066,178 additions and 0 deletions.
54,682 changes: 54,682 additions & 0 deletions Miovision Data/Dorchester Road and Huron Church Road_tmc_data_test.csv

Large diffs are not rendered by default.

113,749 changes: 113,749 additions & 0 deletions Miovision Data/Dorchester Road and Huron Church Road_tmc_data_train.csv

Large diffs are not rendered by default.

30,292 changes: 30,292 additions & 0 deletions Miovision Data/Dragoon and Fisher Fwy Ser Drs_tmc_data_test.csv

Large diffs are not rendered by default.

66,199 changes: 66,199 additions & 0 deletions Miovision Data/Dragoon and Fisher Fwy Ser Drs_tmc_data_train.csv

Large diffs are not rendered by default.

17,817 changes: 17,817 additions & 0 deletions Miovision Data/Grand Blvd W and Jeffries Fwy NSD_tmc_data_test.csv

Large diffs are not rendered by default.

33,722 changes: 33,722 additions & 0 deletions Miovision Data/Grand Blvd W and Jeffries Fwy NSD_tmc_data_train.csv

Large diffs are not rendered by default.

16,754 changes: 16,754 additions & 0 deletions Miovision Data/Grand Blvd W and Jeffries Fwy SSD_tmc_data_test.csv

Large diffs are not rendered by default.

35,935 changes: 35,935 additions & 0 deletions Miovision Data/Grand Blvd W and Jeffries Fwy SSD_tmc_data_train.csv

Large diffs are not rendered by default.

34,206 changes: 34,206 additions & 0 deletions Miovision Data/Lafayette Boulevard and Waterman Street_tmc_data_test.csv

Large diffs are not rendered by default.

72,022 changes: 72,022 additions & 0 deletions Miovision Data/Lafayette Boulevard and Waterman Street_tmc_data_train.csv

Large diffs are not rendered by default.

60,491 changes: 60,491 additions & 0 deletions Miovision Data/Malden Road and Huron Church Road_tmc_data_test.csv

Large diffs are not rendered by default.

130,034 changes: 130,034 additions & 0 deletions Miovision Data/Malden Road and Huron Church Road_tmc_data_train.csv

Large diffs are not rendered by default.

Binary file added Miovision Data/README - Data.pdf
Binary file not shown.
61,257 changes: 61,257 additions & 0 deletions Miovision Data/Totten Street and Huron Church Road_tmc_data_test.csv

Large diffs are not rendered by default.

133,312 changes: 133,312 additions & 0 deletions Miovision Data/Totten Street and Huron Church Road_tmc_data_train.csv

Large diffs are not rendered by default.

68,022 changes: 68,022 additions & 0 deletions Miovision Data/Travel Time - test dataset - Raw.csv

Large diffs are not rendered by default.

137,616 changes: 137,616 additions & 0 deletions Miovision Data/Travel Time - train dataset - Raw.csv

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions Miovision Data/example_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import pandas as pd

# Define the files we want to load
travel_time_file = "Travel Time - train dataset - Raw.csv"
tmc_file = "Dorchester Road and Huron Church Road_tmc_data_train.csv"

# Load the TMC data into a dataframe
tmc_df = pd.read_csv(tmc_file, parse_dates=["dt_bin"])
tt_df = pd.read_csv(travel_time_file, parse_dates=["Start time", "End time"])

# Some code to prepare and aggreagte the travel time data

tt_agg_df = tt_df.groupby(
[
pd.Grouper(key="Start time", freq="15Min"), # You can adjust the frequency here
"Source name",
"Source ID",
"Destination name",
"Destination ID",
]
).agg(["mean", "median", "count"])

# Reset the index to make joining simpler
tt_agg_df.reset_index()

# And let's flatten the column hiearchy
tt_agg_df.columns = [" ".join(col).strip() for col in tt_agg_df.columns.values]

# We can also aggregate the TMC data
tmc_agg_df = tmc_df.groupby(["Intersection Name", "Intersection ID", "dt_bin"]).sum()
tmc_agg_df = tmc_agg_df.reset_index()

# Here's how you can join the datasets together

merged_df = pd.merge(
tmc_agg_df,
tt_agg_df,
how="left",
left_on=["dt_bin", "Intersection ID"],
right_on=["Start time", "Source ID"],
)
27 changes: 27 additions & 0 deletions asdf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pandas as pd
import matplotlib.pyplot as plt
from basic_tests import dorchester_arr

testing = pd.read_csv("Miovision Data/Dorchester Road and Huron Church Road_tmc_data_test.csv")[["dt_bin", "Direction", "Movement Type",
"Vehicle Classification",
"Number of Vehicles"]]
print(dorchester_arr[0])


vehicles_aggregate = testing[["Vehicle Classification", "Number of Vehicles"]]

vehicles = testing["Vehicle Classification"]
unique_vehicles = []
for vehicle in vehicles:
if vehicle not in unique_vehicles:
unique_vehicles.append(vehicle)

#print(vehicles_aggregate)

totals = {unique_vehicles[i]: 0 for i in range(0, len(unique_vehicles))}

for i in range(0, len(vehicles_aggregate)):
totals[vehicles_aggregate["Vehicle Classification"][i]] += vehicles_aggregate["Number of Vehicles"][i]


#print(totals)

0 comments on commit 38e6826

Please sign in to comment.