Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Class notes Computer science and technology

Rating
-
Sold
-
Pages
83
Uploaded on
26-06-2024
Written in
2023/2024

In this you can learn about control flow,tuples,functions,lists operators etc...

Institution
Course

Content preview

AD23211 PYTHON FOR DATA SCIENCE L T P C
3 0 0 3
COURSE OBJECTIVES:
 To learn to solve problems using Python conditionals and loops, functions, lists and
tuples to solve problems.
 To use Python data structures – Sets, dictionaries to represent complex data and also
input/output with files in Python.
 To outline an overview of exploratory data analysis.
 To implement arrays, Data frames and Datasets using NumPy and Pandas
 To implement data visualization using Matplotlib.

UNIT I CONTROL FLOW, FUNCTIONS, LISTS, TUPLES 9
Python interpreter – Data types – variables - expressions - Boolean values and operators -
Conditionals: conditional (if) - alternative (if-else) - chained conditional (if- elif-
else);Iteration: while - for - break - continue - pass; Fruitful functions: return values
- parameters - local and global scope - function composition - recursion; Strings - String
Operations - Lists as arrays. Lists: list operations - list slices - list methods - list loop -
mutability - aliasing - cloning lists - list parameters; Tuples: tuple assignment - tuple as
return value

UNIT II SETS, DICTIONARIES, FILES, PACKAGES 9
Sets – operations - methods; Dictionaries - operations and methods; advanced list processing
- list comprehension. Files and exceptions: text files - reading and writing files - format
operator; command line arguments - Errors and exceptions - handling exceptions - Modules -
Packages; Illustrative Programs.

UNIT III FUNDAMENTALS OF DATA SCIENCE 9
Need for data science – benefits and uses – facets of data – data science process – setting the
research goal – retrieving data – cleansing - integrating and transforming data -Exploratory
Data Analysis (EDA) fundamentals – Understanding data science – Significance of EDA –
Making sense of data –Software tools for EDA - Visual Aids for
EDA. Case Study: Health care - Retail - Banking-Fraud Detection.

UNIT IV NUMPY AND PANDAS 9
Understanding Data Types in Python -The Basics of NumPy Arrays - Computation on NumPy
Arrays: Universal Functions - Aggregations: Min, Max, and Everything In Between. Introducing
Pandas Objects - Data Indexing and Selection - Operating on Data in Pandas - Handling Missing
Data - Hierarchical Indexing - Combining Datasets: Concat and Append - Combining Datasets:
Merge and Join - Aggregation and Grouping - Pivot Tables - Vectorized String Operations -
Working with Time Series.

UNIT V VISUALIZATION WITH MATPLOTLIB 9
Importing Matplotlib – Simple line plots – Simple scatter plots – visualizing errors – density and
contour plots – Histograms – legends – colors – subplots – text and annotation – customization –
three dimensional plotting - Geographic Data with Basemap - Visualization with Seaborn.

TOTAL : 45 PERIODS

, UNIT I CONTROLFLOW, FUNCTIONS, LISTS, TUPLES


Python interpreter – Data types – variables - expressions - Boolean values and operators -
Conditionals: conditional (if) - alternative (if-else) - chained conditional (if- elif-else);Iteration:
while - for - break - continue - pass; Fruitful functions: return values- parameters - local and global
scope - function composition - recursion; Strings - String Operations - Lists as arrays. Lists: list
operations - list slices - list methods - list loop - mutability - aliasing - cloning lists - list parameters;
Tuples: tuple assignment - tuple as return value

1. Outline the modes Python interpreter works. (2 MARKS) (NOV 2017)
2. What is list in python? Give an example. (2 MARKS) (NOV 2017)
3.Difference between compiler and interpreter. (2 MARKS) (NOV 2019)

INTRODUCTION TO PYTHON:

Python is a popular programming language. Python is a general -purpose
interpreted, interactive, object-oriented and high-levelprogramming language. Python
was developed by Guido Van Rossum at the National Research Institute for Mathematics
and Computer Sciences in late eighties and early nineties.

Uses:

 web development (server-side),
 software development,
 mathematics,
 system scripting.

Python can do,

 Python can be used on a server to create web applications.
 Python can be used alongside software to create workflows.
 Python can connect to database systems. It can also read and modify files.
 Python can be used to handle big data and perform complex mathematics.
 Python can be used for rapid prototyping, or for production-ready software
development.

Need for Python:

 Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
 Python has a simple syntax similar to the English language.
 Python has syntax that allows developers to write programs with fewer lines
than some other programming languages.
 Python runs on an interpreter system, meaning that code can be executed as
soon as it is written. This means that prototyping can be very quick.
 Python can be treated in a procedural way, an object-oriented way or a
functional way.

,Python Syntax compared to other programming languages:

 Python was designed for readability, and has some similarities to the English
language with influence from mathematics.
 Python uses new lines to complete a command, as opposed to other programming
languages which often use semicolons or parentheses.
 Python relies on indentation, using whitespace, to define scope; such as the scope
of loops, functions and classes. Other programming languages often use curly-
brackets for this purpose.

Python features:

 Easy-to-learn: Python has an extraordinarily simple syntax and hence it is easy-
to- learn for beginners.
 Easy-to-maintain: Python’s source code is easy-to-maintain.
 Extensive libraries: The python standard library is huge. A library is a collection of
precompiled routines that a program can use. Using python library various things
can be done like regular expressions, documentation, generation, unit testing,
email, cryptography, GUI, etc.
 Interactive mode: Python has shell prompt that provides interactive mode of
writing, testing and debugging python code.
 Extensible: Python is extensible (ie.) a critical piece of code can be in C or C++
andpython can use that piece of code in it.
 Portable: Python can run on a wide variety of platforms .Due to its open
sourcenature, python has been ported to (i.e. changed to make it work on) many
platforms.
 Scalable: Python provides a better structure and support for large programs. An
interpreter reads a high-level program and executes it. It process the program a
little at a time, alternately, reading lines and performing computations.

PYTHON INTERPRETER:

Python is processed at runtime by the interpreter. The python interpreter is a
program that reads and executes python code. Therefore, it is not necessary to compile
the program before executing it.

PYTHON IS INTERACTIVE:

Python has two basic modes: script and interactive.

 The normal mode is the mode where the scripted and finished .py files are run in
the Python interpreter.
 Interactive mode is a command line shell which gives immediate feedback for each
statement, while running previously fed statements in active memory. As new
lines are fed into the interpreter, the fed program is evaluated both in part and in
whole.
 Interactive mode is a good way to play around and try variations on syntax.

,  On macOS or linux, open a terminal and simply type "python". On Windows, bring
up the command prompt and type "py", or start an interactive Python session by
selecting "Python (command line)", "IDLE", or similar program from the task bar
/ app menu. IDLE is a GUI which includes both an interactive mode and options to
edit and run files.

Python should print something like this:

$ python
Python 3.0b3 (r30b3:66303, Sep 8 2008, 14:01:02) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

The >>> is Python's way of telling you that you are in interactive mode. In interactive
mode what you type is immediately run. Try typing 1+1 in. Python will respond with 2.
Interactive mode allows you to test out and see what Python will do. If you ever feel the
need to play with new Python statements, go into interactive mode and try them out.

A sample interactive session:
>>> 5
5
>>> print(5*7)
35
>>> "hello" * 2
'hellohello'
>>> "hello". class
<type 'str'>

However, you need to be careful in the interactive environment to avoid confusion.

Python provides a prompt or interactive shell using which the users can interact with the
interpreter directly to write programs. The shell prompt (or command line) is one where
one types commands. The shell is the main way of accessing program and doing work on
the system.

Python is object oriented,

Python is an objected oriented programming language. Everything in python is an
object. Using python we can create classes and objects.

Classes: Class is like a blueprint that helps to create an object. In other words, a class
comprises variables, methods, functions. Or you can refer class which contains properties
and behavior. For example Consider a class “Ball” now the properties of Ball might be
color, diameter, price and the behavior of the ball might be rolling, bouncing.

Objects: Objects are an instance of a class. With the help of objects, we can access the
method and function of a class.

Written for

Course

Document information

Uploaded on
June 26, 2024
Number of pages
83
Written in
2023/2024
Type
Class notes
Professor(s)
Arumugam
Contains
All classes

Subjects

$10.39
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
kanisha1

Get to know the seller

Seller avatar
kanisha1 Self
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions