Question: Please add the code to Add/Subtract the inventory if the parts numbers match in the existing CSV file. import pandas as pd import sys part
Please add the code to Add/Subtract the inventory if the parts numbers match in the existing CSV file.
import pandas as pd import sys
part = [] row = [] col = [] tt = [] dt = []
def inf_input(): part.append(input("Please enter the part number: ") or '-') row.append(input("Please enter the part row location on the workflow rack: ") or '-') col.append(input("Please enter the part column location on the workflow rack: ") or '-') tt.append(input("Please enter the total count in stock: ") or '-') dt.append(input("Please enter the date in xx/xx/xxxx format: ") or '-')
def meum(): while True: print("----------------------") print("HID GLOBAL INVENTORY") print("----------------------") print("[1] INPUT PART INTO INVENTORY") print("[2] REMOVE PART FROM INVENTORY") print("[3] EXIT PROGRAM")
option = int(input("Enter your option: ")) if option == 1: inf_input() elif option == 3: df = pd.DataFrame({"PART NUMBER": part, "ROW NUMBER": row, "COLUMNS NUMBER": col, "TOTAL": tt, "DATE": dt}) df.to_csv('data.csv') print("EXITING PROGRAM.") break else: print("PLEASE ENTER A VALID OPTION!") continue
if __name__ == '__main__': meum()

1 import pandas as pd 2 3 part [] 4 row = [] 5 col = [] 6 tt = [] 7 dt = [] 8 9 LO def inf_input(): 11 part.append(input ("Please enter the part number: ") or '-') 12 row.append(input("Please enter the part row location on the workflow rack: ") or '-') 3 col.append(input ("Please enter the part column location on the workflow rack: ") or '-') 4 tt.append(input ("Please enter the total count in stock: ") or '-') 5 dt.append(input("Please enter the date in xx/xx/xxxx format: ") or '-') 6 17 18 def meum(): 19 while True: 20 print(" ") 21 print ("HID GLOBAL INVENTORY") print(" ---") print("[1] INPUT PART INTO INVENTORY") print("[2] EXIT PROGRAM") 28 29 30 31 32 33 34 option = int(input ("Enter your option: ")) if option == 1: inf_input() elif option == 2: df = pd. DataFrame ({ "PART NUMBER": part, "ROW NUMBER": row, "COLUMNS NUMBER": col, "TOTAL": tt, "DATE": dt}) df.to_csv ('data.csv') print ("EXITING PROGRAM.") break else: print("PLEASE ENTER A VALID OPTION!") continue 36 37 38 39 if 40 41 name main ': meum) 1 import pandas as pd 2 3 part [] 4 row = [] 5 col = [] 6 tt = [] 7 dt = [] 8 9 LO def inf_input(): 11 part.append(input ("Please enter the part number: ") or '-') 12 row.append(input("Please enter the part row location on the workflow rack: ") or '-') 3 col.append(input ("Please enter the part column location on the workflow rack: ") or '-') 4 tt.append(input ("Please enter the total count in stock: ") or '-') 5 dt.append(input("Please enter the date in xx/xx/xxxx format: ") or '-') 6 17 18 def meum(): 19 while True: 20 print(" ") 21 print ("HID GLOBAL INVENTORY") print(" ---") print("[1] INPUT PART INTO INVENTORY") print("[2] EXIT PROGRAM") 28 29 30 31 32 33 34 option = int(input ("Enter your option: ")) if option == 1: inf_input() elif option == 2: df = pd. DataFrame ({ "PART NUMBER": part, "ROW NUMBER": row, "COLUMNS NUMBER": col, "TOTAL": tt, "DATE": dt}) df.to_csv ('data.csv') print ("EXITING PROGRAM.") break else: print("PLEASE ENTER A VALID OPTION!") continue 36 37 38 39 if 40 41 name main ': meum)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
