mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 23:41:27 +00:00
clean up yfinance index commands for errors
This commit is contained in:
@@ -71,14 +71,16 @@ def get_index(
|
||||
)
|
||||
|
||||
if column not in index_data.columns:
|
||||
return console.print(
|
||||
console.print(
|
||||
f"The chosen column is not available for {ticker}. Please choose "
|
||||
f"between: {', '.join(index_data.columns)}"
|
||||
f"between: {', '.join(index_data.columns)}\n"
|
||||
)
|
||||
return pd.Series()
|
||||
if index_data.empty or len(index_data) < 2:
|
||||
return console.print(
|
||||
console.print(
|
||||
f"The chosen index {ticker}, returns no data. Please check if "
|
||||
f"there is any data available."
|
||||
f"there is any data available.\n"
|
||||
)
|
||||
return pd.Series()
|
||||
|
||||
return index_data[column]
|
||||
|
||||
@@ -66,7 +66,9 @@ def show_indices(
|
||||
indices_data: pd.DataFrame = pd.DataFrame()
|
||||
|
||||
for index in indices:
|
||||
indices_data[index] = get_index(index, interval, start_date, end_date, column)
|
||||
index_data = get_index(index, interval, start_date, end_date, column)
|
||||
if not index_data.empty:
|
||||
indices_data[index] = index_data
|
||||
|
||||
if not store:
|
||||
if external_axes is None:
|
||||
|
||||
Reference in New Issue
Block a user