Page 51 - IPP-12-2025
P. 51

ch6 = int(input("Enter choice: "))

                           if ch6 == 1:

                               row_index = int(input("Enter the row index to search:"))
                               print(dfair.loc[row_index])

                           elif ch6 == 2:

                               col_name = input("Enter column name to search: ")

                               print(dfair[col_name])

                           elif ch6 == 3:
                               break

                   elif ch == 7:

                       while True:

                           print("Data Visualization Menu")

                           print("1. Line Plot")

                           print("2. Vertical Bar Plot")
                           print("3. Horizontal Bar Plot")

                           print("4. Histogram")

                           print("5. Exit")

                           ch7 = int(input("Enter choice: "))

                           if ch7 == 1:
                               n = int(input("Enter number of rows to plot: "))

                               df = dfair.head(n)

                               df.plot(kind="line")

                               plt.title("Line Plot")

                               plt.xlabel("Index")
                               plt.ylabel("Values")

                               plt.show()

                           elif ch7 == 2:

                               n = int(input("Enter number of rows to plot: "))

                               df = dfair.head(n)
                               df.plot(kind="bar")

                               plt.title("Vertical Bar Plot")
   46   47   48   49   50   51   52   53   54   55   56