mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 04:52:07 +00:00
create a title out of the route being used to use it as table title (#6356)
This commit is contained in:
@@ -154,6 +154,7 @@ class PlatformController(BaseController):
|
||||
obbject = translator.execute_func(parsed_args=ns_parser)
|
||||
df: pd.DataFrame = None
|
||||
fig: OpenBBFigure = None
|
||||
title = f"{self.PATH}{translator.func.__name__}"
|
||||
|
||||
if obbject:
|
||||
Registry.register(obbject)
|
||||
@@ -172,11 +173,11 @@ class PlatformController(BaseController):
|
||||
df = obbject.to_dataframe()
|
||||
if isinstance(df.columns, pd.RangeIndex):
|
||||
df.columns = [str(i) for i in df.columns]
|
||||
print_rich_table(df, show_index=True)
|
||||
print_rich_table(df=df, show_index=True, title=title)
|
||||
|
||||
elif isinstance(obbject, dict):
|
||||
df = pd.DataFrame.from_dict(obbject, orient="index")
|
||||
print_rich_table(df, show_index=True)
|
||||
print_rich_table(df=df, show_index=True, title=title)
|
||||
|
||||
elif obbject:
|
||||
Session().console.print(obbject)
|
||||
|
||||
Reference in New Issue
Block a user