Page 49 - IPP-12-2025
P. 49

elif ch3 == 4:

                               n = int(input("Enter how many records you want to display from
               the bottom: "))
                               print(dfair.tail(n))

                           elif ch3 == 5:

                               break

                   elif ch == 4:

                       while True:
                           print("Working on Records Menu")

                           print("1. Insert a specific temperature Record")

                           print("2. Delete a specific temperature Record")

                           print("3. Update a specific temperature Record")

                           print("4. Exit")
                           ch4 = int(input("Enter choice: "))

                           if ch4 == 1:

                               temp = input("Enter Temperature: ")

                               humidity = input("Enter Humidity: ")

                               no2 = input("Enter No2: ")
                               co2 = input("Enter Co2: ")

                               air_quality = input("Enter Air Quality: ")

                               dfair.loc[len(dfair)] = [temp, humidity, no2, co2,
               air_quality]

                               print("Data successfully inserted.")

                           elif ch4 == 2:
                               row_index = int(input("Enter row index to delete: "))

                               dfair.drop(index=row_index, inplace=True)

                               print("Data successfully deleted.")

                           elif ch4 == 3:

                               row_index = int(input("Enter row index to update: "))
                               temp = input("Enter new Temperature: ")

                               humidity = input("Enter new Humidity: ")

                               no2 = input("Enter new No2: ")
   44   45   46   47   48   49   50   51   52   53   54