Skip to content

Commit

Permalink
Use string values instead of ints to represent axes
Browse files Browse the repository at this point in the history
It's clearer and more explicit.
  • Loading branch information
caleb531 committed Feb 22, 2024
1 parent a07412a commit 7b689c3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ica/analyzers/message_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_sums_by_day(dfs: ica.DataFrameNamespace) -> pd.DataFrame:
)
.resample("D", on="datetime")
.sum()
.rename_axis("date", axis=0)
.rename_axis("date", axis="index")
.assign(is_from_them=assign_lambda(lambda df: df["text"] - df["is_from_me"]))
)

Expand Down
2 changes: 1 addition & 1 deletion ica/analyzers/totals_by_day.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main() -> None:
)
.resample("D", on="datetime")
.sum()
.rename_axis("date", axis=0)
.rename_axis("date", axis="index")
# Filter out any rows for dates where neither person sent a message
.pipe(pipe_lambda(lambda df: df[df["text"] != 0]))
# Add a column for the by-day number of messages from the other
Expand Down
4 changes: 2 additions & 2 deletions ica/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_messages_dataframe(
)
# Remove 'attributedBody' column now that it has been merged into the
# 'text' column
.drop("attributedBody", axis=1)
.drop("attributedBody", axis="columns")
# Use a regex-based heuristic to determine which messages are reactions
.assign(
is_reaction=assign_lambda(
Expand Down Expand Up @@ -268,7 +268,7 @@ def prepare_df_for_output(df: pd.DataFrame) -> pd.DataFrame:
},
)
# Prettify index column name
.rename_axis(prettify_header_name(df.index.name), axis=0)
.rename_axis(prettify_header_name(df.index.name), axis="index")
# Make all indices start from 1 instead of 0, but only if the index is
# the default (rather than a custom column)
.pipe(
Expand Down

0 comments on commit 7b689c3

Please sign in to comment.