Page 340 - Informatics_Practices_Fliipbook_Class12
P. 340

\nMain Menu-------:

                     1 Append a record in DataFrame
                     2 Display data in DataFrame

                     3 To visualize data using line and bar graphs
                     4 To delete data from dataframe
                     5 Display description of DataFrame
                     6 Exit

                   '''

            while(True):

                print(menu)
                choice = int(input("Enter Choice:"))



                if choice == 1:
                    print('Enter the following details to append a new record in the DataFrame:\n')



                    nameEvent = input('Enter name of Event:')
                    SportsPersonName = input('Enter name of sports person:')
                    category = input('Enter category:')
                    medalType = input('Enter type of Medal:')

                    prizeMoney = input('Cash prize:')


                    recordList = [nameEvent,SportsPersonName,category,medalType,prizeMoney]

                    df.iloc[-1] = recordList
                    df.to_csv('data.csv',index=False)
                elif choice == 2:

                    displayData()
                elif choice == 3:
                    visualizeData()

                elif choice == 4:
                    deleteData()
                elif choice == 5:
                    describeData()

                elif choice == 6:
                    import sys

                    sys.exit()
                else:
                    print('Please enter valid choice\n')


          326  Touchpad Informatics Practices-XII
   335   336   337   338   339   340   341   342   343   344   345