Skip to content

Commit

Permalink
Merge pull request #658 from shankari/fix_metrics_returning_ints
Browse files Browse the repository at this point in the history
Fix numpy encodings while returning metrics results
  • Loading branch information
shankari authored Apr 19, 2019
2 parents ba8f1bb + d7b54ea commit 18d2364
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions emission/analysis/result/metrics/simple_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ def get_count(mode_section_grouped_df):
def get_distance(mode_section_grouped_df):
ret_dict = {}
for (mode, mode_section_df) in mode_section_grouped_df:
ret_dict[mode] = mode_section_df.distance.sum()
ret_dict[mode] = float(mode_section_df.distance.sum())
return ret_dict

def get_duration(mode_section_grouped_df):
ret_dict = {}
for (mode, mode_section_df) in mode_section_grouped_df:
ret_dict[mode] = mode_section_df.duration.sum()
ret_dict[mode] = float(mode_section_df.duration.sum())
return ret_dict

def get_median_speed(mode_section_grouped_df):
Expand All @@ -45,5 +45,5 @@ def get_median_speed(mode_section_grouped_df):
if np.isnan(mode_median):
logging.debug("still found nan for mode %s, skipping")
else:
ret_dict[mode] = mode_median
ret_dict[mode] = float(mode_median)
return ret_dict
2 changes: 2 additions & 0 deletions emission/net/ext_service/geocoder/nominatim.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def make_url_geo(cls, address):
query_url = NOMINATIM_QUERY_URL + "/search?"
encoded_params = urllib.parse.urlencode(params)
url = query_url + encoded_params
logging.debug("For geocoding, using URL %s" % url)
return url

@classmethod
Expand Down Expand Up @@ -72,6 +73,7 @@ def make_url_reverse(cls, lat, lon):
query_url = NOMINATIM_QUERY_URL + "/reverse?"
encoded_params = urllib.parse.urlencode(params)
url = query_url + encoded_params
logging.debug("For reverse geocoding, using URL %s" % url)
return url

@classmethod
Expand Down

0 comments on commit 18d2364

Please sign in to comment.