Skip to content

Commit b09961f

Browse files
committed
Use DataFrame.attrs instead of direct attribute assignment
Fixes pandas UserWarning about creating columns via attribute names. Uses the proper pandas API for storing metadata on DataFrames.
1 parent b9bb460 commit b09961f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

github_activity/github_activity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ def generate_activity_md(
461461
# add column for participants in each issue (not just original author)
462462
data["contributors"] = [[]] * len(data)
463463

464-
# Get bot users from GraphQL data
465-
bot_users = getattr(data, "bot_users", set())
464+
# Get bot users from GraphQL data (stored in DataFrame attrs)
465+
bot_users = data.attrs.get("bot_users", set())
466466

467467
def ignored_user(username):
468468
if username in bot_users:

github_activity/graphql.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ def is_bot(user_dict):
274274

275275
# Create a dataframe of the issues and/or PRs
276276
self.data = pd.DataFrame(self.issues_and_or_prs)
277-
# Attach bot users set to dataframe for use in github_activity.py
278-
self.data.bot_users = bot_users
277+
# Store bot users in DataFrame metadata (attrs dict)
278+
self.data.attrs["bot_users"] = bot_users
279279

280280
# Add some extra fields
281281
def get_login(user):

0 commit comments

Comments
 (0)