mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-05 00:42:19 +00:00
place it inside exception
This commit is contained in:
@@ -80,13 +80,14 @@ class CommandOutput(GenericModel, Generic[T], Tagged):
|
||||
df = basemodel_to_df(self.results, "date")
|
||||
else:
|
||||
df = basemodel_to_df(self.results, "date")
|
||||
|
||||
if df.index.name == "date":
|
||||
df.index = pd.to_datetime(df.index)
|
||||
df.sort_index(axis=0, inplace=True)
|
||||
|
||||
except Exception as e:
|
||||
raise OpenBBError("Failed to convert results to DataFrame.") from e
|
||||
|
||||
if df.index.name == "date":
|
||||
df.index = pd.to_datetime(df.index)
|
||||
df.sort_index(axis=0, inplace=True)
|
||||
|
||||
return df
|
||||
|
||||
def to_dict(self) -> Dict[str, List]:
|
||||
|
||||
Reference in New Issue
Block a user