Skip to content

Commit

Permalink
update display_changes to avoid error
Browse files Browse the repository at this point in the history
  • Loading branch information
Aminsinichi committed Mar 23, 2024
1 parent dc6246e commit 755490c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions wearablehrv/individual.py
Original file line number Diff line number Diff line change
Expand Up @@ -2337,16 +2337,19 @@ def display_changes(
)

def display_formatted_dataframe(df, title):
formatted_df = df.applymap(lambda x: f"{x:.2f}")
try:
from IPython.display import display, Markdown

# Using Styler.format for formatting the DataFrame for display
formatted_df = df.style.format("{:.2f}")
display(Markdown(f"**{title}**"))
display(formatted_df)
display(Markdown("---"))
except:
print(title)
print(formatted_df)
print(
df.applymap(lambda x: f"{x:.2f}")
) # fallback to applymap in a non-IPython environment
print("\n")

def display_dataframes(time_feature, frequency_feature):
Expand Down

0 comments on commit 755490c

Please sign in to comment.