From 5f8657bbfa210d17a3d8c4536721bbf0a67bc873 Mon Sep 17 00:00:00 2001 From: Theodore Aptekarev Date: Mon, 5 Jun 2023 15:17:42 +0200 Subject: [PATCH] Avoid pandas' SettingWithCopyWarning (#5105) --- openbb_terminal/helper_funcs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py index 5d425dfee96..1e6b53a298a 100644 --- a/openbb_terminal/helper_funcs.py +++ b/openbb_terminal/helper_funcs.py @@ -300,6 +300,9 @@ def print_rich_table( current_user.preferences.USE_INTERACTIVE_DF and plots_backend().isatty ) + # Make a copy of the dataframe to avoid SettingWithCopyWarning + df = df.copy() + show_index = not isinstance(df.index, pd.RangeIndex) and show_index # convert non-str that are not timestamp or int into str # eg) praw.models.reddit.subreddit.Subreddit