[go: up one dir, main page]

0% found this document useful (0 votes)
5 views24 pages

Nptel Presentation

The document provides an overview of Python, its history, and its applications in data science, particularly using libraries like NumPy and Pandas for statistical analysis and data visualization. It explains Python's execution model, array creation, attributes, and operations, highlighting the differences between NumPy arrays and Python lists. Additionally, it covers various statistical operations that can be performed using NumPy.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views24 pages

Nptel Presentation

The document provides an overview of Python, its history, and its applications in data science, particularly using libraries like NumPy and Pandas for statistical analysis and data visualization. It explains Python's execution model, array creation, attributes, and operations, highlighting the differences between NumPy arrays and Python lists. Additionally, it covers various statistical operations that can be performed using NumPy.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

MADHAV INSTITUTE OF

TECHNOLOGY AND SCIENCES

SESSION:-2023-24
DATA SCIENCE USING PYTHON
(160517)
NPTEL PRESENTATION

SUBMITTED TO- SUBMITTED BY-


PROF. AKANCHHA TIWARI SHUBHANSHU TIWARI
MA’AM 0901IT211054
IT 5TH SEMESTER
WHAT IS PYTHON …?
• Python is a general purpose programming language that is
often applied in scripting roles.
• So, Python is programming language as well as scripting
language.
• Python is also called as Interpreted language
HISTORY
• Invented in the Netherlands, early 90s by Guido van Rossum
• Python was conceived in the late 1980s and its
implementation was started in December 1989
• Guido Van Rossum is fan of 'Monty Python's Flying Circus’,
this is a famous TV show in Netherlands
• Named after Monty Python
• Open sourced from the beginning
SCOPE OF PYTHON
• Science
- Bioinformatics
• System Administration
-Unix
-Web logic
-Web sphere
• Web Application Development
-CGI
WHAT CAN I DO WITH PYTHON ... ?
• System programming
• Graphical User Interface Programming
• Internet Scripting
• Component Integration
• Database Programming
• Gaming, Images, XML , Robot and more…
PYTHON CODE EXECUTION
Python's traditional runtime execution model: source code you type is translated
to byte code, which is then run by the Python Virtual Machine. Your code is
automatically compiled, but then it is interpreted.

Source code extension is .py


Byte code extension is .pyc (compiled python code)
PYTHON LIBRARY
• Python library is a collection of functions and methods that allows you/user to
perform many action without writing complex code
PYTHON LIBRARIES FOR STATISTICAL ANALYSIS AND
DATA VISUALIZATION
• NumPy (numerical computing / complex mathematical computation)
– Scientific Computations
– Multi-dimensional array objects
– Data manipulation
• Pandas (data manipulation with pandas)
– Dataframe Objects
– Process large data sets
– Complex Data Analysis
– Time Series Data
NUMPY
• It stands for Numerical Python (Core library for numeric & scientific computing
).
• NumPy is a Python library used for working with arrays.
• The array object in NumPy is called ndarray.
• NumPy arrays are stored at one continuous place in memory unlike lists, so
processes can access and manipulate them very efficiently. This behavior is
called locality of reference in computer science.
• NumPy arrays are used to store Homogeneous data.
NUMPY ARRAY V/S PYTHON LIST

• All elements of array are of same data type. List can have elements of different data types.
• Elements of an array are stored in contiguous . List elements are not stored contiguously
memory locations in memory.
• Arrays are static and can not be resized once . List can be resized and modify easily.
they are created
• Arrays support element wise operation. List do not support element wise operation.
• Arrays take less space in memory. List take more space in memory
ARRAY CREATION
● np.zeros ((rows,cols)) : Initialising numpy array with 0.

● np.full ((dim.),value) : Initialising array with any value.

● np.ones ((row,col)) : Initialising array with any 1.


● np.arange (initial-val, final-val, gap) : create array within a range

● np.random.randint (initial val, final val, no.of random int) :


Initialise array with random numbers. Random is sub module inside NumPy and
randint() method of random.
ARRAY ATTRIBUTES
1. ndim : to get dimension of array. E.g. 1-Dimension, 2-D…
2. shape : to get shape. E.g. 2x3 , 3x2
3. size : size means number of elements.
4. dtype : data type of elements stored in array. E.g. int, float…
5. itemsize : size of items stored. E.g. for int size = 4 bytes
CHANGING ARRAY SHAPE
● You have 3 attributes - shape=(a,b) , reshape(a,b) , resize(a,b)

ALL METHODS ARE USED AS A FORM OF ARRAY


INDEXING IN ARRAY

2-Dimensional
SLICING IN ARRAY
ARR[START-INDEX : END-INDEX :
STEP]
OPERATIONS ON ARRAY
SORTING AN ARRAY
● np.sort( array-name ) : make a copy of original array and returns
the sorted copy without changing original array.
● np.argsort( array-name ) : sort the copy of original array and
returns the Index of sorted list without changing original array.
● array-name.sort( ) : sort the original array and returns nothing.

By default sorting is done in ascending


order, to reverse the order simply reverse
the answer with slicing as a[ : :-1]
By default sorting is done Row wise. To do it column wise do axis = 0
axis = 0 means “Column wise”
axis = 1 means “Row wise”
STATISTICAL OPERATIONS

● np.max( array-name )
● np.min( array-name )
● np.sum( array-name )
● np.mean( array-name )
● np.median( array-name )
● np.prod( array-name )
● np.var( array-name )
● np.std( array-name )

You might also like