From 93b9208380684b1001aeff6ec413f917296eb260 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 14 Jun 2022 23:58:51 -0500 Subject: [PATCH] Fixed warnings bug which does not display data if there is an inf value data point --- openbb_terminal/helper_funcs.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py index d2e02c4eadc5..ec3fc180ff12 100644 --- a/openbb_terminal/helper_funcs.py +++ b/openbb_terminal/helper_funcs.py @@ -31,6 +31,7 @@ import requests from screeninfo import get_monitors import yfinance as yf +import numpy as np from openbb_terminal.rich_config import console from openbb_terminal import feature_flags as obbff @@ -673,6 +674,10 @@ def lambda_clean_data_values_to_float(val: str) -> float: def lambda_int_or_round_float(x) -> str: """Format int or round float""" + # If the data is inf, -inf, or NaN then simply return '~' because it is either too + # large, too small, or we do not have data to display for it + if x in (np.inf, -np.inf, np.nan): + return " " + "~" if (x - int(x) < -sys.float_info.epsilon) or (x - int(x) > sys.float_info.epsilon): return " " + str(round(x, 2))