diff --git a/src/main_generator_notebook.ipynb b/src/main_generator_notebook.ipynb index 42c20fd..f32bbe8 100644 --- a/src/main_generator_notebook.ipynb +++ b/src/main_generator_notebook.ipynb @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 20, "metadata": { "scrolled": false }, @@ -56,7 +56,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "3b95936354a245759c69cd0157ff7791", + "model_id": "c669d7f3d67143ba988ff8ea2b9a9034", "version_major": 2, "version_minor": 0 }, @@ -70,7 +70,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "6e14e93ab57c4fb784c6d42cd58bbfc2", + "model_id": "339f144c68394d0d9499b718b09f4faa", "version_major": 2, "version_minor": 0 }, @@ -84,7 +84,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "25c5c668597341fab5b2b99c3580d516", + "model_id": "90a6132e8a5f44b7a71a397cab84267b", "version_major": 2, "version_minor": 0 }, @@ -98,7 +98,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "ba12d221cef04e2cbabf48cd81d6ee6a", + "model_id": "1f638ca7da764cb09cac8e40a99c13a6", "version_major": 2, "version_minor": 0 }, diff --git a/src/synthetic_data_generation/generators.py b/src/synthetic_data_generation/generators.py index a7591f6..62703c1 100644 --- a/src/synthetic_data_generation/generators.py +++ b/src/synthetic_data_generation/generators.py @@ -1314,18 +1314,30 @@ def create_a_summary_table(df_total_user: pd.DataFrame, places_count = 0.0 delta_count = 0.0 if not temp_df.empty: - social_situation_count = temp_df[f"{meal}_social_situation"].value_counts( + filter_nan_out = temp_df[~temp_df[f"{meal}_social_situation"].isin([ + 'N/A'])] + social_situation_count = filter_nan_out[f"{meal}_social_situation"].value_counts( + ) + filter_nan_out = temp_df[~temp_df[f"{meal}_place"].isin([ + 'N/A'])] + places_count = filter_nan_out[f"{meal}_place"].value_counts( ) - places_count = temp_df[f"{meal}_place"].value_counts() delta_count = { "mean": temp_df[f"{meal}_delta"].mean(), "std": temp_df[f"{meal}_delta"].std() } - temp_list.append(f"""
  • {meal.capitalize()}: -

    social situations consume meal: {', '.join([ind+':'+str(social_situation_count[ind]) if ind != "N/A" else "N/A" for ind in social_situation_count.index])}

    -

    places consume meal: {', '.join([ind+':'+str(places_count[ind]) if ind != "N/A" else "N/A" for ind in places_count.index])}

    -

    appreciation: {delta_count['mean']} ± {delta_count['std']}

    + if len(places_count) == 0 and len(social_situation_count) == 0: + temp_list.append(f"""
  • {meal.capitalize()}: +

    social situations consume meal: N/A

    +

    places consume meal: N/A

    +

    appreciation: N/A

  • """) + else: + temp_list.append(f"""
  • {meal.capitalize()}: +

    social situations consume meal: {', '.join([ind+':'+str(social_situation_count[ind]) if ind != "N/A" else "N/A" for ind in social_situation_count.index])}

    +

    places consume meal: {', '.join([ind+':'+str(places_count[ind]) if ind != "N/A" else "N/A" for ind in places_count.index])}

    +

    appreciation: {delta_count['mean']} ± {delta_count['std']}

    +
  • """) # print( # f"calculated values condition {condition}: {meal} mean {mean} std {std}") else: