Page 69 - IPP-12-2025
P. 69

11.  groupby():  It  allows  to  split  your  data  into  separate  groups  to  perform  computations  for
                    better analysis.
               12.  mean(): This function returns the mean (average) from a set of values for the given axis.
               13.  median(): This function returns the middle number from a set of values for the given axis.
               14.  mode(): This function returns the mode value, i.e., the value that appears most often, from
                    a set of values.
               15.  info(): This function is used to print a concise summary of dataframe.
               16.  input():  It  gives  a  prompt,  gets  input  from  the  user  and  returns  the  data  in  a  format
                    interpreted by Python.
               Matplotlib Functions

                 1.  plot(): It is the function that is used to plot a graph for a given set of data (line graph by default).
                 2.  bar(): It is used to plot a bar chart for a given set of data.
                 3.  hist(): This function allows us to create and plot histogram from a given sequence of numbers.
                 4.  xlabel(): It is used to set labels for the X-axis.
                 5.  ylabel(): It is used to set labels for the Y-axis.
                 6.  title(): This function is used to add a title to a plot.
                 7.  legend(): It is used to add legend to a plot.
                 8.  show(): It is used in the end to show a plot as per the given specifications.
               SOURCE CODE

               import  pandas  as  pd
               import matplotlib.pyplot as plt
               import numpy as np
               try:
                 result = pd.read_csv("Forest_Data.csv", index_col=0)
               except FileNotFoundError:
                   print("Error: File not found. Please check the file path and try again.")
                   exit()
               while True:
                   print("\nMain Menu")
                   print("1. Display Data")
                   print("2. Dataframe Statistics")
                   print("3. Display Records")
                   print("4. Working on Records")
                   print("5. Working on Columns")
                   print("6. Search Specific Row/Column")
                   print("7. Data Visualization")
                   print("8. Data Analytics")
                   print("9. Exit")
                   try:
                      ch = int(input("Enter your choice: "))
                   except ValueError:
                      print("Invalid input. Please enter a valid number.")
                      continue
                   if ch == 1:
                      print(result)
                   elif ch == 2:
                      while True:
                        print("\nDataframe Statistics Menu")
                        print("1. Display the Transpose")
                        print("2. Display all column names")
                        print("3. Display the indexes")
   64   65   66   67   68   69   70   71   72   73   74