Skip to content

Commit

Permalink
Create dir for data artifacts if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenwindflower committed Jan 6, 2023
1 parent dfaa1bd commit f88fc6a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ site/

# data artifacts

data/
data/
jaffle-data/
16 changes: 10 additions & 6 deletions jafgen/simulation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import uuid

import pandas as pd
Expand Down Expand Up @@ -114,10 +115,13 @@ def save_results(self):
df_supplies = pd.DataFrame.from_dict(Stock.to_dict())
# ask Drew about what the heck is up with the to_dict generator stuff

if not os.path.exists("./jaffle-data"):
os.makedirs("./jaffle-data")

# save output
df_customers.to_csv("./data/customers.csv", index=False)
df_items.to_csv("./data/items.csv", index=False)
df_orders.to_csv("./data/orders.csv", index=False)
df_products.to_csv("./data/products.csv", index=False)
df_stores.to_csv("./data/stores.csv", index=False)
df_supplies.to_csv("./data/supplies.csv", index=False)
df_customers.to_csv("./jaffle-data/customers.csv", index=False)
df_items.to_csv("./jaffle-data/items.csv", index=False)
df_orders.to_csv("./jaffle-data/orders.csv", index=False)
df_products.to_csv("./jaffle-data/products.csv", index=False)
df_stores.to_csv("./jaffle-data/stores.csv", index=False)
df_supplies.to_csv("./jaffle- data/supplies.csv", index=False)
3 changes: 0 additions & 3 deletions jafgen/stores/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,3 @@ def to_dict(cls):
Supply(id="SUP-029", name="lime", cost=0.13, perishable=True, skus=["BEV-005"]),
]
)

for supply in Stock.stock:
print(Stock.stock[supply])

0 comments on commit f88fc6a

Please sign in to comment.