Page 71 - IPP-12-2025
P. 71
print("1. Insert a specific State/UT Detail")
print("2. Delete a specific State/UT Detail")
print("3. Update a specific State/UT Detail")
print("4. Exit to Main Menu")
try:
ch4 = int(input("Enter your choice: "))
except ValueError:
print("Invalid input. Please enter a number.")
continue
if ch4 == 1:
state_index = int(input("Enter State/UT index:"))
st=input("Enter State/UT Name:")
det_2021 = int(input("Nov 2021 to June 2022: "))
det_2022 = int(input("Nov 2022 to June 2023: "))
if state_index in result.index:
print("Already existing State name")
elif det_2021 <0 or det_2022 <0:
print("Error ,Detections cannot be negative")
else:
result.loc[state_index] = [st,det_2021, det_2022]
print("Data successfully inserted.")
elif ch4 == 2:
state_index = int(input("Enter State/UT index:"))
if state_index in result.index:
result.drop([state_index], inplace=True)
print("Data successfully deleted.")
else:
print("State/UT not found.")
elif ch4 == 3:
state_index = int(input("Enter State/UT index:"))
if state_index in result.index:
state=input("State Name:")
det_2021 = int(input("Nov 2021 to June 2022: "))
det_2022 = int(input("Nov 2022 to June 2023: "))
result.loc[state_index] = [state,det_2021, det_2022]
print("Data successfully updated.")
else:
print("State/UT not found.")
elif ch4 == 4:
break
else:
print("Invalid choice. Please try again.")
elif ch == 5:
while True:
print("\nWorking on Columns Menu")
print("1. Add a Column")
print("2. Delete a Column")
print("3. Rename a Column")
print("4. Exit to Main Menu")
try:
ch5 = int(input("Enter your choice: "))
except ValueError:
print("Invalid input. Please enter a number.")
continue
if ch5 == 1:
col_name = input("Enter the column name: ")