Alvianojs commited on
Commit
8855170
·
1 Parent(s): ddd31fd

Update src/map_viz_pred.py

Browse files
Files changed (1) hide show
  1. src/map_viz_pred.py +7 -10
src/map_viz_pred.py CHANGED
@@ -11,8 +11,11 @@ import requests
11
  import pandas as pd
12
  import datetime
13
 
14
- def calling_pred_map_viz():
15
- r = "snazzy-image-01.svg"
 
 
 
16
  tree = etree.parse(r)
17
  root = tree.getroot()
18
  path_elems = root.findall('.//{http://www.w3.org/2000/svg}path')
@@ -35,7 +38,6 @@ def calling_pred_map_viz():
35
  continue
36
 
37
 
38
- counts_df1 = merge_volumes(counts_df)
39
  counts_df1.loc[:,'date_time'] = pd.to_datetime(counts_df1.loc[:,'date'] + " "+ counts_df1.loc[:,'time'], format='%Y-%m-%d %H:%M:%S')
40
  counts_df1.loc[:,'hour'] = counts_df1.loc[:,'date_time'].apply(hour_rounder)
41
  counts_df1.loc[:,'day_name'] = counts_df1.loc[:,'date_time'].dt.day_name()
@@ -86,14 +88,9 @@ def calling_pred_map_viz():
86
 
87
  fig = plt.figure(figsize=(10,10))
88
  ax = fig.add_subplot(111)
89
- # ax.close()
90
  collection.set_transform(ax.transData)
91
  ax.add_artist(collection)
92
  ax.set_xlim([100, 1900])
93
  ax.set_ylim([1800, 0])
94
- ax.text(200, 100, '1,000,000', color='r', size='large', name = 'Georgia')
95
- ax.set_title(datetime.datetime.strptime(last_date, '%Y-%m-%d').strftime('%a, %d %B %Y') + " | " + last_time + " SGT", fontname = 'Georgia')
96
- plt.show()
97
-
98
-
99
- calling_map_viz()
 
11
  import pandas as pd
12
  import datetime
13
 
14
+ import warnings
15
+ warnings.filterwarnings("ignore")
16
+
17
+ def calling_pred_map_viz(counts_df1, input_date = None, input_hour = None):
18
+ r = "svg/snazzy-image-01.svg"
19
  tree = etree.parse(r)
20
  root = tree.getroot()
21
  path_elems = root.findall('.//{http://www.w3.org/2000/svg}path')
 
38
  continue
39
 
40
 
 
41
  counts_df1.loc[:,'date_time'] = pd.to_datetime(counts_df1.loc[:,'date'] + " "+ counts_df1.loc[:,'time'], format='%Y-%m-%d %H:%M:%S')
42
  counts_df1.loc[:,'hour'] = counts_df1.loc[:,'date_time'].apply(hour_rounder)
43
  counts_df1.loc[:,'day_name'] = counts_df1.loc[:,'date_time'].dt.day_name()
 
88
 
89
  fig = plt.figure(figsize=(10,10))
90
  ax = fig.add_subplot(111)
 
91
  collection.set_transform(ax.transData)
92
  ax.add_artist(collection)
93
  ax.set_xlim([100, 1900])
94
  ax.set_ylim([1800, 0])
95
+ ax.set_title(datetime.datetime.strptime(filtered_day + " | " + filtered_hour + " SGT", fontname = 'Georgia')
96
+ return fig