Skip to content

Commit

Permalink
Fixed the format data functions to only check if a value is nan if it…
Browse files Browse the repository at this point in the history
… is a float
  • Loading branch information
twheys committed Aug 23, 2016
1 parent 5e65c60 commit 17b7678
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fireant/slicer/transformers/datatables.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def _format_data_point(value):
else:
return value.strftime('%Y-%m-%dT%H:%M:%S')

if value is None or np.isnan(value):
if value is None or (isinstance(value, float) and np.isnan(value)):
return None

if isinstance(value, np.int64):
Expand Down Expand Up @@ -304,7 +304,7 @@ def _format_column_labels(self, csv_df, metrics, dimensions):
dimension_label = dimensions[dimension_level]['label_options'].get(dimension_value, dimension_value)
else:
dimension_label = dimension_value

dimension_label = _format_data_point(dimension_label)

if dimension_label is not None:
Expand Down
2 changes: 1 addition & 1 deletion fireant/slicer/transformers/highcharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def _format_data_point(value):
return value
if isinstance(value, pd.Timestamp):
return int(value.asm8) // int(1e6)
if np.isnan(value):
if value is None or (isinstance(value, float) and np.isnan(value)):
return None
if isinstance(value, np.int64):
# Cannot serialize np.int64 to json
Expand Down

0 comments on commit 17b7678

Please sign in to comment.