Skip to content

Commit

Permalink
added index = False to .to_csv to avoid doing shit in the csvs
Browse files Browse the repository at this point in the history
  • Loading branch information
edouardbruelhart committed Jun 11, 2024
1 parent 768bff4 commit 16bf043
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stock_manager/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ def __init__(self, add: tk.Toplevel, root: tk.Tk):
# Sort data alphabetically
df_ingredients = pd.read_csv(path_ingredients)
df_ingredients_sorted = df_ingredients.sort_values(by=["type_ingredient", "ingredient"])
df_ingredients_sorted.to_csv(path_ingredients)
df_ingredients_sorted.to_csv(path_ingredients, index=False)
df_recettes = pd.read_csv(path_recettes)
df_recettes_sorted = df_recettes.sort_values(by="nom_biere")
df_recettes_sorted.to_csv(path_recettes)
df_recettes_sorted.to_csv(path_recettes, index=False)

# Load sorted data
self.df_recettes = pd.read_csv(path_recettes)
Expand Down Expand Up @@ -420,10 +420,10 @@ def __init__(self, remove: tk.Toplevel, root: tk.Tk):
# Sort data alphabetically
df_ingredients = pd.read_csv(path_ingredients)
df_ingredients_sorted = df_ingredients.sort_values(by=["type_ingredient", "ingredient"])
df_ingredients_sorted.to_csv(path_ingredients)
df_ingredients_sorted.to_csv(path_ingredients, index=False)
df_recettes = pd.read_csv(path_recettes)
df_recettes_sorted = df_recettes.sort_values(by="nom_biere")
df_recettes_sorted.to_csv(path_recettes)
df_recettes_sorted.to_csv(path_recettes, index=False)

# Load sorted data
self.df_recettes = pd.read_csv(path_recettes)
Expand Down Expand Up @@ -953,7 +953,7 @@ def save_recipe(self) -> None:
# Sort data alphabetically
df_recettes = pd.read_csv(path_recettes)
df_recettes_sorted = df_recettes.sort_values(by="nom_biere")
df_recettes_sorted.to_csv(path_recettes)
df_recettes_sorted.to_csv(path_recettes, index=False)
else:
self.status_write.config(text="Aucune recette définie!", foreground="red")

Expand Down Expand Up @@ -1014,7 +1014,7 @@ def add_ingredient(self, ingredient_type: str, ingredient: str, rounded: int) ->
# Sort data alphabetically
df_ingredients = pd.read_csv(path_ingredient)
df_ingredients_sorted = df_ingredients.sort_values(by=["type_ingredient", "ingredient"])
df_ingredients_sorted.to_csv(path_ingredient)
df_ingredients_sorted.to_csv(path_ingredient, index=False)

else:
# If ingredient type or ingredient is empty, inform the user to enter correct values
Expand Down

0 comments on commit 16bf043

Please sign in to comment.