summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Aptekarev <aptekarev@gmail.com>2023-06-05 15:17:42 +0200
committerGitHub <noreply@github.com>2023-06-05 13:17:42 +0000
commit5f8657bbfa210d17a3d8c4536721bbf0a67bc873 (patch)
treea5c0616058b84a7ec4e7f21970e1caf915d2776a
parentf0e02170834d43692320fde45bf83fcf0b4892fe (diff)
Avoid pandas' SettingWithCopyWarning (#5105)
-rw-r--r--openbb_terminal/helper_funcs.py3
1 files changed, 3 insertions, 0 deletions
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