Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed warnings bug which does not display data if there is an inf value data point #1948

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions openbb_terminal/helper_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand Down