Python Unit I Installation Guide PDF

Summary

This document provides a step-by-step guide for installing Python 3.7.3 on Windows 10. The instructions cover downloading installers, configuring system variables, verifying installation in the command prompt or IDLE, and include information about variables and identifier naming in Python. The document is intended to help users with the installation process of Python 3.7.3 on Windows.

Full Transcript

Subject: Object Oriented Programming Using Python UNIT - I Installation and Working with Python Installing and using Python on Windows 10 is very simple. The installation procedure involves just three steps: 1. Download the binaries 2. Run the Execu...

Subject: Object Oriented Programming Using Python UNIT - I Installation and Working with Python Installing and using Python on Windows 10 is very simple. The installation procedure involves just three steps: 1. Download the binaries 2. Run the Executable installer 3. Add Python to PATH environmental variables To install Python, you need to download the official Python executable installer. Next, you need to run this installer and complete the installation steps. Finally, you can configure the PATH variable to use python from the command line. You can choose the version of Python you wish to install. It is recommended to install the latest version of Python, which is 3.7.3 at the time of writing this article. Step 1: Download the Python Installer binaries 1. Open the official Python website ((www.python.org) in your web browser. Navigate to the Downloads tab for Windows. 2. Choose the latest Python 3 release. In our example, we choose the latest Python 3.7.3 version. 3. Click on the link to download Windows x86 executable installer If you are using a 32-bit installer. In case your Windows installation is a 64-bit system, then download Windows x86-64 executable installer. Step 2: Run the Executable Installer 1. Once the installer is downloaded, run the Python installer. 2. Check the Install launcher for all users check box. Further, you may check the Add Python 3.7 to path check box to include the interpreter in the execution path. 4. Select Customize installation. Choose the optional features by checking the following check boxes: 3. Documentation 4. pip 5. tcl/tk and IDLE (to install tkinter and IDLE) 6. Python test suite (to install the standard library test suite of Python) 7. Install the global launcher for `.py` files. This makes it easier to start Python 8. Install for all users. Click Next.8. This takes you to Advanced Options available while installing Python. Here, select the Install for all users and Add Python to environment variables check boxes. Optionally, you can select the Associate files with Python, Create shortcuts for installed applications and other advanced options. Make note of the python installation directory displayed in this step. You would need it for the next step. After selecting the Advanced options, click Install to start installation. 10. Once the installation is over, you will see a Python Setup Successful window. Step 3: Add Python to environmental variables The last (optional) step in the installation process is to add Python Path to the System Environment variables. This step is done to access Python through the command line. In case you have added Python to environment variables while setting the Advanced options during the installation procedure, you can avoid this step. Else, this step is done manually as follows. In the Start menu, search for “advanced system settings”. Select “View advanced system settings”. In the “System Properties” window, click on the “Advanced” tab and then click on the “Environment Variables” button. Locate the Python installation directory on your system. If you followed the steps exactly as above, python will be installed in below locations: C:\Program Files (x86)\Python37-32: for 32-bit installation C:\Program Files\Python37-32: for 64-bit installation The folder name may be different from “Python37-32” if you installed a different version. Look for a folder whose name starts with Python. Append the following entries to PATH variable as shown below: Step 4: Verify the Python Installation You have now successfully installed Python 3.7.3 on Windows 10. You can verify if the Python installation is successful either through the command line or through the IDLE app that gets installed along with the installation. Search for the command prompt and type “python”. You can see that Python 3.7.3 is successfully installed. An alternate way to reach python is to search for “Python” in the start menu and clicking on IDLE (Python 3.7 64-bit). You can start coding in Python using the Integrated Development Environment(IDLE). Understanding Python variables : Variable is a name that is used to refer to memory location. Python variable is also known as an identifier and used to hold value. In Python, we don't need to specify the type of variable because Python is a infer language and smart enough to get variable type. Variable names can be a group of both the letters and digits, but they have to begin with a letter or an underscore. It is recommended to use lowercase letters for the variable name. Msc and msc both are two different variables. Identifier Naming Variables are the example of identifiers. An Identifier is used to identify the literals used in the program. The rules to name an identifier are given below. o The first character of the variable must be an alphabet or underscore ( _ ). o All the characters except the first character may be an alphabet of lower-case(a-z), upper-case (A-Z), underscore, or digit (0-9). o Identifier name must not contain any white-space, or special character (!, @, #, %, ^, &, *). o Identifier name must not be similar to any keyword defined in the language. o Identifier names are case sensitive; for example, my name, and MyName is not the same. o Examples of valid identifiers: a123, _n, n_9, etc. o Examples of invalid identifiers: 1a, n%4, n 9, etc. Object References It is necessary to understand how the Python interpreter works when we declare a variable. The process of treating variables is somewhat different from many other programming languages. Python is the highly object-oriented programming language; that's why every data item belongs to a specific type of class Let's understand the following example 1. a = 50 In the above image, the variable a refers to an integer object. Suppose we assign the integer value 50 to a new variable b. a = 50 b=a The variable b refers to the same object that a points to because Python does not create another object. Let's assign the new value to b. Now both variables will refer to the different objects. a = 50 b =100 Python manages memory efficiently if we assign the same variable to two different values. Example: name = "Shourya" age = 12 marks = 90.56 print(name) print(age) print(marks) Output: Shourya 12 90.56 Python Interpreter: Shell/REPL: Python is an interpreter language. It means it executes the code line by line. Python provides a Python Shell, which is used to execute a single Python command and display the result. It is also known as REPL (Read, Evaluate, Print, Loop), where it reads the command, evaluates the command, prints the result, and loop it back to read the command again. To run the Python Shell, open the command prompt or power shell on Windows and terminal window on mac, write python and press enter. A Python Prompt comprising of three greater- than symbols >>> appears, as shown below. Python Shell/REPL Now, you can enter a single statement and get the result. For example, enter a simple expression like 3 + 2, press enter and it will display the result in the next line, as shown below. Execute Python Commands in Shell Execute Python Script As you have seen above, Python Shell executes a single statement. To execute multiple statements, create a Python file with extension.py, and write Python scripts (multiple statements). For example, enter the following statement in a text editor such as Notepad. Example: myPythonScript.py print ("This is Python Script.") print ("Welcome to Python Tutorial by TutorialsTeacher.com") Save it as myPythonScript.py, navigate the command prompt to the folder where you have saved this file and execute the python myPythonScript.py command, as shown below. It will display the result. Thus, you can execute Python expressions and commands using Python REPL to quickly execute Python code. Python IDLE: Every Python installation comes with an Integrated Development and Learning Environment, which you’ll see shortened to IDLE or even IDE. These are a class of applications that help you write code more efficiently. While there are many IDEs for you to choose from, Python IDLE is very bare-bones, which makes it the perfect tool for a beginning programmer. Python IDLE comes included in Python installations on Windows and Mac. If you’re a Linux user, then you should be able to find and download Python IDLE using your package manager. Once you’ve installed it, you can then use Python IDLE as an interactive interpreter or as a file editor. The shell is the default mode of operation for Python IDLE. When you click on the icon to open the program, the shell is the first thing that you see: This is a blank Python interpreter window. You can use it to start interacting with Python immediately. You can test it out with a short line of code: Different IDE’s : 1. IDLE IDLE (Integrated Development and Learning Environment) is a default editor that accompanies Python This IDE is suitable for beginner level developers The IDLE tool can be used on Mac OS, Windows, and Linux Price: Free Most notable features of IDLE include: Ability to search for multiple files Interactive interpreter with syntax highlighting, and error and i/o messages Smart indenting, along with basic text editor features A very capable debugger 2. PyCharm PyCharm is a widely used Python IDE created by JetBrains This IDE is suitable for professional developers and facilitates the development of large Python projects Price: Freemium The most notable features of PyCharm include: Support for JavaScript, CSS, and TypeScript Smart code navigation Quick and safe code refactoring Support features like accessing databases directly from the IDE 3. Visual Studio Code Visual Studio Code is an open-source (and free) IDE created by Microsoft. It finds great use for Python development VS Code is lightweight and comes with powerful features that only some of the paid IDEs offer Price: Free The most notable features of Visual Studio Code include: One of the best smart code completion is based on various factors Git integration Code debugging within the editor It provides an extension to add additional features like code linting, themes, and other services 4. Sublime Text 3 Sublime Text is a very popular code editor. It supports many languages, including Python It is highly customizable and also offers fast development speeds and reliability Price: Free The most notable features of Sublime Text 3 include: Syntax highlighting Custom user commands for using the IDE Efficient project directory management It supports additional packages for the web and scientific Python development 5. Atom Atom is an open-source code editor by Github and supports Python development Atom is similar to Sublime Text and provides almost the same features emphasis on speed and usability Price: Free The most notable features of Atom include: Support for a large number of plugins Smart autocompletion Supports custom commands for the user to interact with the editor Support for cross-platform development 6. Jupyter Jupyter is widely used in the field of data science It is easy to use, interactive and allows live code sharing and visualization Price: Free The most notable features of Jupyter include: Supports for the numerical calculations and machine learning workflow Combine code, text, and images for greater user experience Intergeneration of data science libraries like NumPy, Pandas, and Matplotlib 7. Spyder Spyder is an open-source IDE most commonly used for scientific development Spyder comes with Anaconda distribution, which is popular for data science and machine learning Price: Free The most notable features of Spyder include: Support for automatic code completion and splitting Supports plotting different types of charts and data manipulation Integration of data science libraries like NumPy, Pandas, and Matplotlib 8. PyDev PyDev is a strong python interpreter and is distributed as a third-party plugin for Eclipse IDE Being flexible, it is one of the preferred open-source IDE by the developers Price: Free The most notable features of PyDev include: Django integration, auto code completion, and code coverage Supports type hinting, refactoring, as well as debugging and code analysis Good support for Python web development 9. Thonny Thonny is an IDE ideal for teaching and learning Python programming Price: Free The most notable features of Thonny include: Simple debugger Function evaluation Automatic syntax error detection Detailed view of variables used in a Python program or project 10. Wing The wing is also a popular IDE that provides a lot of good features to ensure a productive environment Wing offers a 30-day trial version for the developers to check and understand the features of this IDE Price: US $95 - US$179 for commercial license The most notable features of Wing include: It provides immediate feedback to your Python code It provides support for test-driven development with unit tests, Pytest, and Django testing framework. It assists in remote development Auto code completion is present Python Data Types There are different types of data types in Python. Some built-in Python data types are: Numeric data types: int, float, complex String data types: str Sequence types: list, tuple, range Binary types: bytes, bytearray, memoryview Mapping data type: dict Boolean type: bool Set data types: set, frozenset 1. Python Numeric Data Type Python numeric data type is used to hold numeric values like; 1. int - holds signed integers of non-limited length. 2. long- holds long integers(exists in Python 2.x, deprecated in Python 3.x). 3. float- holds floating precision numbers and it’s accurate up to 15 decimal places. 4. complex- holds complex numbers. In Python, we need not declare a datatype while declaring a variable like C or C++. We can simply just assign values in a variable. But if we want to see what type of numerical value is it holding right now, we can use type(), like this: #create a variable with integer value. a=100 print("The type of variable having value", a, " is ", type(a)) #create a variable with float value. b=10.2345 print("The type of variable having value", b, " is ", type(b)) #create a variable with complex value. c=100+3j print("The type of variable having value", c, " is ", type(c)) If you run the above code you will see output like the below image. 2. Python String Data Type The string is a sequence of characters. Python supports Unicode characters. Generally, strings are represented by either single or double-quotes. a = "string in a double quote" b= 'string in a single quote' print(a) print(b) # using ',' to concatenate the two or several strings print(a,"concatenated with",b) #using '+' to concate the two or several strings print(a+" concated with "+b) The above code produces output like the below picture- 3. Python List Data Type The list is a versatile data type exclusive in Python. In a sense, it is the same as the array in C/C++. But the interesting thing about the list in Python is it can simultaneously hold different types of data. Formally list is an ordered sequence of some data written using square brackets([]) and commas(,). #list of having only integers a= [1,2,3,4,5,6] print(a) #list of having only strings b=["hello","john","reese"] print(b) #list of having both integers and strings c= ["hey","you",1,2,3,"go"] print(c) #index are 0 based. this will print a single character print(c) #this will print "you" in list c The above code will produce output like this- 4. Python Tuple The tuple is another data type which is a sequence of data similar to a list. But it is immutable. That means data in a tuple is write-protected. Data in a tuple is written using parenthesis and commas. #tuple having only integer type of data. a=(1,2,3,4) print(a) #prints the whole tuple #tuple having multiple type of data. b=("hello", 1,2,3,"go") print(b) #prints the whole tuple #index of tuples are also 0 based. print(b) #this prints a single element in a tuple, in this case "go" The output of this above python data type tuple example code will be like the below image. 5. Python Dictionary Python Dictionary is an unordered sequence of data of key-value pair form. It is similar to the hash table type. Dictionaries are written within curly braces in the form key:value. It is very useful to retrieve data in an optimized way among a large amount of data. #a sample dictionary variable a = {1:"first name",2:"last name", "age":33} #print value having key=1 print(a) #print value having key=2 print(a) #print value having key="age" print(a["age"]) If you run this python dictionary data type example code, the output will be like the below image. Python Operators: Operators are the constructs which can manipulate the value of operands. Consider the expression 4 + 5 = 9. Here, 4 and 5 are called operands and + is called operator. Types of Operator Python language supports the following types of operators. Arithmetic Operators Comparison (Relational) Operators Assignment Operators Logical Operators Bitwise Operators Membership Operators Identity Operators Let us have a look on all operators one by one. Python Arithmetic Operators Assume variable a holds 10 and variable b holds 20, then − [ Show Example ] Operator Description Example + Addition Adds values on either side of the operator. a+b= 30 - Subtraction Subtracts right hand operand from left hand operand. a–b=- 10 * Multiplies values on either side of the operator a*b= Multiplication 200 / Division Divides left hand operand by right hand operand b/a=2 % Modulus Divides left hand operand by right hand operand and returns remainder b%a= 0 ** Exponent Performs exponential (power) calculation on operators a**b =10 to the power 20 // Floor Division - The division of operands where the result is 9//2 = 4 and the quotient in which the digits after the decimal point are 9.0//2.0 removed. But if one of the operands is negative, the result is = 4.0, - 11//3 = - floored, i.e., rounded away from zero (towards negative 4, - infinity) − 11.0//3 = -4.0 Python Comparison Operators These operators compare the values on either sides of them and decide the relation among them. They are also called Relational operators. Assume variable a holds 10 and variable b holds 20, then − [ Show Example ] Operator Description Example == If the values of two operands are equal, then the condition becomes true. (a == b) is not true. != If values of two operands are not equal, then condition becomes true. (a != b) is true. If values of two operands are not equal, then condition becomes true. (a b) is true. This is similar to != operator. > If the value of left operand is greater than the value of right operand, then (a > b) is condition becomes true. not true. < If the value of left operand is less than the value of right operand, then (a < b) is condition becomes true. true. >= If the value of left operand is greater than or equal to the value of right (a >= b) operand, then condition becomes true. is not true. return_type: """Doctring""" # body of the function return expression The following example uses arguments that you will learn later in this article so you can come back on it again if not understood. It is defined here for people with prior experience in languages like C/C++ or Java. def add(num1: int, num2: int) -> int: """Add two numbers""" num3 = num1 + num2 return num3 # Driver code num1, num2 = 5, 15 ans = add(num1, num2) print(f"The addition of {num1} and {num2} results {ans}.") Output: The addition of 5 and 15 results 20. Lambda Function: Python Lambda Functions are anonymous function means that the function is without a name. As we already know that the def keyword is used to define a normal function in Python. Similarly, the lambda keyword is used to define an anonymous function in Python. Lambda Function Syntax Syntax: lambda arguments: expression This function can have any number of arguments but only one expression, which is evaluated and returned. One is free to use lambda functions wherever function objects are required. You need to keep in your knowledge that lambda functions are syntactically restricted to a single expression. It has various uses in particular fields of programming, besides other types of expressions in functions. Python Lambda Function Example Python3 str1 = 'WELCOME' # lambda returns a function object rev_upper = lambda string: string.upper()[::-1] print(rev_upper(str1)) Output: ÉMOCLEW Explanation: In the above example, we defined a lambda function(rev_upper) to convert a string to it’s upper-case and reverse it. Modules in Python: A Python module is a file containing Python definitions and statements. A module can define functions, classes, and variables. A module can also include runnable code. Grouping related code into a module makes the code easier to understand and use. It also makes the code logically organized. organizing Python projects into modules: Let’s create a simple calc.py in which we define two functions, one add and another subtract. A simple module, calc.py def add(x, y): return (x+y) def subtract(x, y): return (x-y) Import Module in Python We can import the functions, and classes defined in a module to another module using the import statement in some other Python source file. When the interpreter encounters an import statement, it imports the module if the module is present in the search path. A search path is a list of directories that the interpreter searches for importing a module. For example, to import the module calc.py, we need to put the following command at the top of the script. Syntax of Python Import import module Importing modules in Python Now, we are importing the calc that we created earlier to perform add operation. # importing module calc.py import calc print(calc.add(10, 2)) Output: 12 The from-import Statement in Python Python’s from statement lets you import specific attributes from a module without importing the module as a whole. Importing specific attributes from the module Here, we are importing specific sqrt and factorial attributes from the math module. # importing sqrt() and factorial from the # module math from math import sqrt, factorial # if we simply do "import math", then # math.sqrt(16) and math.factorial() # are required. print(sqrt(16)) print(factorial(6)) Output: 4.0 720 Import all Names The * symbol used with the from import statement is used to import all the names from a module to a current namespace. Syntax: from module_name import * Syntax: from module_name import * From import * Statement The use of * has its advantages and disadvantages. If you know exactly what you will be needing from the module, it is not recommended to use *, else do so. # importing sqrt() and factorial from the # module math from math import * # if we simply do "import math", then # math.sqrt(16) and math.factorial() # are required. print(sqrt(16)) print(factorial(6)) Output 4.0 720 Dir() in Python: dir() is a powerful inbuilt function in Python3, which returns list of the attributes and methods of any object (say functions , modules, strings, lists, dictionaries etc.) Syntax : dir({object}) object [optional] : Takes object name Returns : dir() tries to return a valid list of attributes of the object it is called upon. Also, dir() function behaves rather differently with different type of objects, as it aims to produce the most relevant one, rather than the complete information For Class Objects, it returns a list of names of all the valid attributes and base attributes as well. For Modules/Library objects, it tries to return a list of names of all the attributes, contained in that module. If no parameters are passed it returns a list of names in the current local scope. Example: # Python3 code to demonstrate dir() # when no parameters are passed # Note that we have not imported any modules print(dir()) # Now let's import two modules import random import math # return the module names added to # the local namespace including all # the existing ones as before print(dir()) Output : ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__'] ['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'math', 'random'] Packages We organize a large number of files in different folders and subfolders based on some criteria, so that we can find and manage them easily. In the same way, a package in Python takes the concept of the modular approach to next logical level. As you know, a module can contain multiple objects, such as classes, functions, etc. A package can contain one or more relevant modules. Physically, a package is actually a folder containing one or more module files. Let's create a package named mypackage, using the following steps: Create a new folder named D:\MyApp. Inside MyApp, create a subfolder with the name 'mypackage'. Create an empty __init__.py file in the mypackage folder. Using a Python-aware editor like IDLE, create modules greet.py and functions.py with the following code: greet.py def SayHello(name): print("Hello ", name) functions.py def sum(x,y): return x+y def average(x,y): return (x+y)/2 def power(x,y): return x**y That's it. We have created our package called mypackage. The following is a folder structure: Package Folder Structure Importing a Module from a Package Now, to test our package, navigate the command prompt to the MyApp folder and invoke the Python prompt from there. D:\MyApp>python Import the functions module from the mypackage package and call its power() function. >>> from mypackage import functions >>> functions.power(3,2) 9 It is also possible to import specific functions from a module in the package. Brief Tour of the Standard Library: Math module : Python has a built-in math module. It is a standard module, so we don't need to install it separately. We only have to import it into the program we want to use. We can import the module, like any other module of Python, using import math to implement the functions to perform mathematical operations. 1. # This program will show the calculation of square root using the math module 2. # importing the math module 3. import math 4. print(math.sqrt( 9 )) 5. Output: 6. 3.0 Datetime Module: In Python, date and time are not a data type of their own, but a module named datetime can be imported to work with the date as well as time. Python Datetime module comes built into Python, so there is no need to install it externally. Python Datetime module supplies classes to work with date and time. These classes provide a number of functions to deal with dates, times and time intervals. Date and datetime are an object in Python, so when you manipulate them, you are actually manipulating objects and not string or timestamps. The DateTime module is categorized into 6 main classes – date – An idealized naive date, assuming the current Gregorian calendar always was, and always will be, in effect. Its attributes are year, month and day. time – An idealized time, independent of any particular day, assuming that every day has exactly 24*60*60 seconds. Its attributes are hour, minute, second, microsecond, and tzinfo. datetime – Its a combination of date and time along with the attributes year, month, day, hour, minute, second, microsecond, and tzinfo. timedelta – A duration expressing the difference between two date, time, or datetime instances to microsecond resolution. tzinfo – It provides time zone information objects. timezone – A class that implements the tzinfo abstract base class as a fixed offset from the UTC (New in version 3.2) Example: from datetime import date # calling the today # function of date class today = date.today() print("Today's date is", today) Output Today's date is 2021-08-19 Turtle Module: Turtle” is a Python feature like a drawing board, which lets us command a turtle to draw all over it! We can use functions like turtle.forward(…) and turtle.right(…) which can move the turtle around. Commonly used turtle methods are : Method Parameter Description Turtle() None Creates and returns a new turtle object Method Parameter Description forward() amount Moves the turtle forward by the specified amount backward() amount Moves the turtle backward by the specified amount right() angle Turns the turtle clockwise left() angle Turns the turtle counterclockwise penup() None Picks up the turtle’s Pen pendown() None Puts down the turtle’s Pen up() None Picks up the turtle’s Pen down() None Puts down the turtle’s Pen Color color() name Changes the color of the turtle’s pen Color fillcolor() name Changes the color of the turtle will use to fill a polygon heading() None Returns the current heading position() None Returns the current position goto() x, y Move the turtle to position x,y begin_fill() None Remember the starting point for a filled polygon end_fill() None Close the polygon and fill with the current fill color dot() None Leave the dot at the current position Leaves an impression of a turtle shape at the current stamp() None location Method Parameter Description shape() shapename Should be ‘arrow’, ‘classic’, ‘turtle’ or ‘circle’ Plotting using Turtle To make use of the turtle methods and functionalities, we need to import turtle.”turtle” comes packed with the standard Python package and need not be installed externally. The roadmap for executing a turtle program follows 4 steps: 1. Import the turtle module 2. Create a turtle to control. 3. Draw around using the turtle methods. 4. Run turtle.done(). So as stated above, before we can use turtle, we need to import it. We import it as : Numpy Module: NumPy, which stands for Numerical Python, is a library consisting of multidimensional array objects and a collection of routines for processing those arrays. Using NumPy, mathematical and logical operations on arrays can be performed. Operations using NumPy Using NumPy, a developer can perform the following operations − Mathematical and logical operations on arrays. Fourier transforms and routines for shape manipulation. Operations related to linear algebra. NumPy has in-built functions for linear algebra and random number generation. Example: import numpy as np a = np.array([1,2,3]) print a output: [1, 2, 3] Scipy Module: SciPy, a scientific library for Python is an open source, BSD-licensed library for mathematics, science and engineering. The SciPy library depends on NumPy, which provides convenient and fast N-dimensional array manipulation. The main reason for building the SciPy library is that, it should work with NumPy arrays. It provides many user-friendly and efficient numerical practices such as routines for numerical integration and optimization. Example: #Import pi constant from both the packages from scipy.constants import pi from math import pi print("sciPy - pi = %.16f"%scipy.constants.pi) print("math - pi = %.16f"%math.pi) output: sciPy - pi = 3.1415926535897931 math - pi = 3.1415926535897931 Pandas Module: Pandas is defined as an open-source library that provides high-performance data manipulation in Python. The name of Pandas is derived from the word Panel Data, which means an Econometrics from Multidimensional data. Data analysis requires lots of processing, such as restructuring, cleaning or merging, etc. There are different tools are available for fast data processing, such as Numpy, Scipy, Cython, and Panda. But we prefer Pandas because working with Pandas is fast, simple and more expressive than other tools. Key Features of Pandas o It has a fast and efficient DataFrame object with the default and customized indexing. o Used for reshaping and pivoting of the data sets. o Group by data for aggregations and transformations. o It is used for data alignment and integration of the missing data. o Provide the functionality of Time Series. o Process a variety of data sets in different formats like matrix data, tabular heterogeneous, time series. o Handle multiple operations of the data sets such as subsetting, slicing, filtering, groupBy, re-ordering, and re-shaping. o It integrates with the other libraries such as SciPy, and scikit-learn. o Provides fast performance, and If you want to speed it, even more, you can use the Cython. Example: import pandas as pd # a list of strings x = ['Python', 'Pandas'] # Calling DataFrame constructor on list df = pd.DataFrame(x) print(df) output: 0 0 Python 1 Pandas By Suchitra Kishanrao Kasbe Department of Computer Science Rajarshi Shahu Mahavidyalaya (Autonomous), Latur

Use Quizgecko on...
Browser
Browser