Skip to content

Commit

Permalink
Fixed issue with topic_names_ attribute when creating tables
Browse files Browse the repository at this point in the history
  • Loading branch information
x-tabdeveloping committed Nov 4, 2024
1 parent 2d57c48 commit 69bdb70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions turftopic/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _topics_table(
show_negative: bool = False,
) -> list[list[str]]:
columns = ["Topic ID"]
if hasattr(self, "topic_names_"):
if getattr(self, "topic_names_", None):
columns.append("Topic Name")
columns.append("Highest Ranking")
if show_negative:
Expand Down Expand Up @@ -146,7 +146,7 @@ def _topics_table(
concat_positive = ", ".join([word for word in vocab[highest]])
concat_negative = ", ".join([word for word in vocab[lowest]])
row = [f"{topic_id}"]
if hasattr(self, "topic_names_"):
if getattr(self, "topic_names_", None):
row.append(self.topic_names_[i_topic])
row.append(f"{concat_positive}")
if show_negative:
Expand Down

0 comments on commit 69bdb70

Please sign in to comment.