Page 15 - Informatics_Practices_Fliipbook_Class12
P. 15

Unit I: Data Handling using Pandas-I


                       1                                       DATA HANDLING USING

                                                                                                 PANDAS











              Chapter Outline


              1.1 Series                                         1.2 Indexing and Slicing
              1.3 Typecasting                                    1.4 Using Dictionary to Create Series Object
              1.5 Operations on Series Objects





            Introduction

            A lot of data is being generated around us all day. For example, satellites launched by India keep sending data to the
            weather, space, and defence departments. Huge amounts of data are being exchanged daily via social media, E-commerce
            websites and financial transactions. Day-to-day operations in educational institutions, hospitals, Governments, and
            other organizations also produce massive amount of data. These data must be analyzed to make rational decisions.
            There are several data analysis tools, such as Pandas, R, SPSS, Excel, Tableau, Power BI, and QlikView/Qlik. In this
            chapter, we will learn data analysis using the open-source Python package Pandas, developed by Wes McKinney. It
            provides easy-to-use data structures and data analysis tools, making it a popular choice for working with tabular data.

            1.1 Series

            Pandas introduces a data structure called a "Series." Similar to a Python list, a series can accommodate objects of
            various types. This versatility proves particularly valuable in numerous applications that demand a mix of object types
            within a series. In this section, we will explore various functionalities of series that contribute to its significance in data
            analysis.
            To begin working with series, we need to import the pandas module. It is customary to use the widely adopted alias
            "pd" to refer to the Pandas library, as demonstrated below:
             >>> import pandas as pd
            Suppose, we already have a list of four names of animals. Using this list, we create a Pandas series animalSeries. A
            series object is created using the Pandas class series.

             >>> import pandas as pd
             >>> animals = ['Elephant', 'Tiger', 'Bear', 'Lion'] #Creating Pandas Series using list
             >>> animalSeries = pd.Series(animals)
             >>> print(animalSeries)
            output:
                 0    Elephant
                 1       Tiger

                                                                                      Data Handling using Pandas  1
   10   11   12   13   14   15   16   17   18   19   20