0% found this document useful (0 votes)
82 views31 pages

Class 4-Python

Uploaded by

Nilanjana Das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
82 views31 pages

Class 4-Python

Uploaded by

Nilanjana Das
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 31

Python Object-Oriented Programming(OOP)

OOP is like building a car using modular parts.


Here, code is broken down into smaller, reusable
pieces called objects that represent real-world
entities.
Classes
Class in Python
Attributes and Methods
Objects
Objects in Python
Creating first Class
Adding parameters to the Class
Creating Class with Constructor

Init method acts as the constructor


Instantiating Object
Libraries in Python

Python Library is a collection of pre-written code containing functions and modules that allows you
to perform many actions without writing your code
Python NumPy

NumPy stands for Numerical Python and is the core library for numeric and scientific computing

It consists of multi
dimensional array
objects
• Lists serve the purpose of arrays, but they are slow(NumPy arrays are
stored at one continuous place in memory unlike lists, so processes
can access and manipulate them very efficiently.)

• NumPy aims to provide an array object that is up to 50x faster than


traditional Python lists.

• The array object in NumPy is called ndarray


Creating NumPy Array

Single-Dimensional Array Multi- Dimensional Array


Initializing NumPy Array

Initializing with 0 Initializing with same number


Initializing NumPy Array

Initializing NumPy Array within a range


Joining NumPy Array

vstack()
hstack() column_stack()
NumPy Intersection and Difference
NumPy Array Mathematics

Basic Addition Basic Multiplication

Basic Subtraction Basic Division


NumPy Math Functions

Mean
Median Standard Deviation
Python Pandas

Pandas stands for Panel Data and is the core library for data manipulation and data analysis

It consists of single and


multi dimensional data
structures for data
manipulation
• Data Manipulation and Transformation: Pandas provides efficient data
structures, such as DataFrames, that allow for easy manipulation,
cleaning, and transformation of data.

• Data Exploration and Analysis: Pandas enables exploratory data analysis


by providing powerful tools for slicing, indexing, and extracting insights
from datasets.

• Integration with other Libraries: Pandas seamlessly integrates with


other popular libraries in the data analysis and scientific computing
ecosystem, such as NumPy, Matplotlib, and scikit-learn.
Pandas Data Structures

Single Dimensional Multi Dimensional


Pandas Series Object

Series Object is a One-Dimensional Labeled array


Changing Index
Series Object from Dictionary

You can also create


series object from a
dictionary!!
Extracting Individual Elements

single element elements from back Sequence of elements


Basic Math Operations on Series

Adding two Series Object


Adding scaler value to Series element
Pandas DataFrames

Dataframe is a 2-Dimensional labelled data-structure

A Dataframe
comprises of rows
and columns
Creating a Dataframe

Creating Dataframe from Dictionary


Creating Dataframe from list
Dataframe In-Built functions

len()

head() describe()

tail() dtypes()

shape()
loc[]
iloc[]

You might also like