Page 72 - IPP-12-2025
P. 72

values = list(map(int, input(f"Enter the values for the column (comma-
                       separated): ").split(",")))
                       result[col_name] = values
                       print("Column",col_name, "added successfully!")
                    elif ch5 == 2:
                       col_name = input("Enter the column name to delete: ")
                       if col_name in result.columns:
                          result.drop(columns=[col_name], inplace=True)
                          print("Column", col_name, "deleted successfully!")
                       else:
                          print("Column not found.")
                    elif ch5 == 3:
                       col_name = input("Enter the column name to rename: ")
                       new_name = input("Enter the new column name: ")
                       if col_name in result.columns:
                          result.rename(columns={col_name: new_name}, inplace=True)
                          print("Column", col_name, "renamed to",new_name)
                       else:
                          print("Column not found.")
                    elif ch5 == 4:
                       break
                    else:
                       print("Invalid choice. Please try again.")
               elif ch == 6:
                  while True:
                    print("\nSearch Menu")
                    print("1. Search details of a specific State/UT")
                    print("2. Search details of a specific time frame column name")
                    print("3. Exit to Main Menu")
                    try:
                       ch6 = int(input("Enter your choice: "))
                    except ValueError:
                       print("Invalid input. Please enter a number.")
                       continue
                    if ch6 == 1:
                       state_index = int(input("Enter the State/UT index: "))
                       if state_index in result.index:
                          print(result.loc[state_index])
                       else:
                          print("State/UT not found.")
                    elif ch6 == 2:
                       col = input("Enter the time frame column name (exactly as listed): ")
                       if col in result.columns:
                          print(result[col])
                       else:
                          print("Column", col, "not found.")
                    elif ch6 == 3:
                       break
                    else:
                       print("Invalid choice. Please try again.")
               elif ch == 7:
                  while True:
                    print("\nData Visualization Menu")
                    print("1. Line Plot")
                    print("2. Vertical Bar Plot")
                    print("3. Horizontal Bar Plot")
                    print("4. Histogram")
              A.16
   67   68   69   70   71   72   73   74   75   76   77