Page 70 - IPP-12-2025
P. 70

print("4. Display the shape")
                    print("5. Display the dimension")
                    print("6. Display the data types of all columns")
                    print("7. Display the size")
                    print("8. Exit to Main Menu")
                    try:
                       ch2 = int(input("Enter your choice: "))
                    except ValueError:
                       print("Invalid input. Please enter a number.")
                       continue
                    if ch2 == 1:
                       print(result.T)
                    elif ch2 == 2:
                       print(result.columns)
                    elif ch2 == 3:
                       print(result.index)
                    elif ch2 == 4:
                       print(result.shape)
                    elif ch2 == 5:
                       print(result.ndim)
                    elif ch2 == 6:
                       print(result.dtypes)
                    elif ch2 == 7:
                       print(result.size)
                    elif ch2 == 8:
                       break
                    else:
                       print("Invalid choice. Please try again.")
               elif ch == 3:
                  while True:
                    print("\nDisplay Records Menu")
                    print("1. Display Top N Records")
                    print("2. Display Bottom N Records")
                    print("3. Details of a specific State/UT")
                    print("4. Display details of all State/UTs")
                    print("5. Exit to Main Menu")
                    ch3 = int(input("Enter your choice: "))
                    if ch3 == 1:
                       n = int(input("Enter the number of records want to display from top: "))
                       print(result.head(n))
                    elif ch3 == 2:
                       n = int(input("Enter the number of records to display from bottom: "))
                       print(result.tail(n))
                    elif ch3 == 3:
                       state = int(input("Enter the State/UT index no. for which you want to
                       see the details: "))
                       if state in result.index:
                          print(result.loc[state])
                       else:
                          print("State/UT not found.")
                    elif ch3 == 4:
                       print(result)
                    elif ch3 == 5:
                       break
               elif ch == 4:
                  while True:
                    print("\nWorking on Records Menu")
              A.14
   65   66   67   68   69   70   71   72   73   74   75