Page 53 - Informatics_Practices_Fliipbook_Class12
P. 53

C T  02     Create a csv file with the following data and read the content of the file in a DataFrame. Also, display the
                         number of rows and columns in the DataFrame.
                         LOCATION_NAME,Real GDP Growth Rate
                         Andaman & Nicobar Islands,0.7
                         Jharkhand,6.57
                         Delhi,11.34

                         Manipur,6.24
                         Nagaland,3.93
                         Punjab,5.79
                         Meghalaya,9.54
                         Assam,8.42
                         Chandigarh,9.61
                         Tamil Nadu,9.39
                         Tripura,8.87
                         West Bengal,7.06

                         Goa,10.65
                         Haryana,8.12
                         Kerala,7.8
                         Himachal Pradesh,7.59
                         Madhya Pradesh,4.73
                         Bihar,13.13
                         Arunachal Pradesh,3.65
                         Gujarat,6.45
                         Karnataka,6.44
                         Mizoram,5.75
                         Orissa,7.18

                         Uttar Pradesh,6.23
                         India,6.88
                         Chhattisgarh,10.81
                         Jammu & Kashmir,6.78
                         Uttarakhand,8.8
                         Puducherry,10.95
                         Rajasthan,7.36
                         Sikkim,6.3

                         Maharashtra,4.97
                         Andhra Pradesh,6.81



            2.6 Retrieving Subset of Data - Indexing and Slicing

            Sometimes, we want to have a look at some data in the beginning or towards the end of a DataFrame. For this purpose,
            Pandas provides two methods, namely, head() and tail().


                                                                             Data Handling using Pandas DataFrame  39
   48   49   50   51   52   53   54   55   56   57   58