Avoid pandas' SettingWithCopyWarning (#5105)

This commit is contained in:
Theodore Aptekarev
2023-06-05 15:17:42 +02:00
committed by GitHub
parent f0e0217083
commit 5f8657bbfa

View File

@@ -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