0% found this document useful (0 votes)
26 views

python intern notes-1

Uploaded by

a.ashraf2727
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)
26 views

python intern notes-1

Uploaded by

a.ashraf2727
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/ 22

DAY 1-3 [05-01-2024 - 08-01-2024]

INTRODUCTION TO PYTHON
Python has grown in prominence in recent years as a robust and adaptable programming
language. Its simplicity, readability, and extensive ecosystem of libraries and frameworks make it
a preferred choice for developers across various domains.

Python is an easy to learn, powerful, general-purpose programming language. It has


efficient high- level data structures and a simple but effective approach to object-oriented
programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature,
make it an ideal language for scripting and rapid application development in many areas on most
platforms.
What is Python?
Python is a popular programming language. It was created by Guido van Rossum, and
released in 1991.
It is used for:
 web development (server-side),
 software development,
 mathematics,
 System scripting.
What can Python 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.
Why 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.
Features of Python?

1. Readability and Simplicity


Python places a strong emphasis on clean, readable code. Its syntax is designed to be highly
readable, with minimal use of brackets and a clear layout using indentation and whitespace. By
relying on indentation to define code blocks, Python enables developers to write code that is not
only easy to write but also easy to read and understand.

Python’s simplicity and readability make it an ideal choice for both beginners and
experienced developers. Beginners can grasp the basics of the language quickly, while
experienced developers appreciate Python’s readability, which significantly reduces debugging
time and enhances code maintainability.
2. Extensive Standard Library
Python comes with an extensive standard library, which is a collection of modules and
packages that offer a wide range of functionalities. These modules and packages help simplify
complex tasks by providing pre-built functionalities, saving developers time and effort.

Python’s standard library includes modules and packages for regular expressions, GUI
programming, networking, data processing, and much more. This vast ecosystem ensures that
developers have access to a wide array of tools without the need for external dependencies. It
streamlines software development and ensures compatibility across different versions of Python.
By leveraging the functionalities provided by the standard library, developers can
significantly boost their productivity and reduce development time.
3. Cross-Platform Compatibility
Python’s cross-platform compatibility allows it to run seamlessly on different operating
systems such as Windows, macOS, and Linux. Developers can write their code once and deploy it
on multiple platforms, saving time and effort in application development.

Cross-platform compatibility is crucial in modern software development, as it enables


applications to reach a broader audience across various devices and operating systems. Python’s
ability to run on multiple platforms makes it a versatile choice for developers who want to build
applications that work everywhere.
4. Dynamic Typing and Dynamic Binding
Python’s cross-platform compatibility allows it to run seamlessly on different operating
systems such as Windows, macOS, and Linux. Developers can write their code once and deploy it
on multiple platforms, saving time and effort in application development.

Cross-platform compatibility is crucial in modern software development, as it enables


applications to reach a broader audience across various devices and operating systems. Python’s
ability to run on multiple platforms makes it a versatile choice for developers who want to build
applications that work everywhere
DAY 5[10-01-2024]

CONDITIONAL STATEMENT & CONTROL FLOW


CONDITIONAL STATEMENTS:

A conditional statement in programming is a construct that allows the execution of


different code blocks based on whether a specified condition evaluates to true or false. It enables
a program to make decisions and choose different paths of execution depending on the
circumstances.

 if statement:
Allows you to execute a block of code only if a specified condition is true.
 if-else statement:
Executes one block of code if the condition is true and another block if the condition is
false.
 elif-statement:
if the previous conditions were not true, then try this condition.

CONTROL STATEMENTS:

Python programming language provides two types of loops – For loop and While loop to
handle looping requirements. a loop is a control structure that allows a set of instructions to be
repeatedly executed until a specific condition is met. Loops are essential for automating
repetitive tasks and iterating over sequences of data

 while Loop
With the while loop we can execute a set of statements as long as a condition is true.

 For Loops
A for loop is used for iterating over a sequence (that is either a list, a tuple, a
dictionary, a set, or a string).

 break Statement
With the break statement we can stop the loop even if the while condition is true.
DAY 6 [11-01-2024]

FUNCTIONS

A function is a block of code which only runs when it is called. You


can pass data, known as parameters, into a function.
A function can return data as a result.
Functions in Python allow you to organize your code into reusable blocks, making it easier
to manage and maintain
Creating a Function
In Python a function is defined using the def keyword
Calling a Function
To call a function, use the function name followed by parenthesis
Parameters or Arguments?
A parameter is the variable listed inside the parentheses in the function definition.
An argument is the value that is sent to the function when it is called.
Arbitrary Arguments, *args
If you do not know how many arguments that will be passed into your function, add a *
before the parameter name in the function definition.
Keyword Arguments
You can also send arguments with the key = value syntax.
Arbitrary Keyword Arguments, **kwargs
If you do not know how many keyword arguments that will be passed into your function,
add two asterisk: ** before the parameter name in the function definition.
The pass Statement
Function definitions cannot be empty, but if you for some reason have a function definition
with no content, put in the pass statement to avoid getting an error.
Recursion
Python also accepts function recursion, which means a defined function can call itself.
Recursion is a common mathematical and programming concept. It means that a function
calls itself. This has the benefit of meaning that you can loop through data to reach a result.
DAY 7 [12-01-2024]

DATA STRUCTURE IN PYTHON

There are four collection data types in the Python programming language:
 List is a collection which is ordered and changeable. Allows duplicate members.
 Tuple is a collection which is ordered and unchangeable. Allows duplicate members.
 Set is a collection which is unordered, unchangeable*, and unindexed. No duplicate
members.
 Dictionary is a collection which is ordered** and changeable. No duplicate members.
List
Lists are used to store multiple items in a single variable. Lists are one of 4 built-in data
types in Python used to store collections of data, the other 3 are Tuple, Set, and Dictionary, all with
different qualities and usage .
Ordered
When we say that lists are ordered, it means that the items have a defined order, and that
order will not change.
Changeable
The list is changeable, meaning that we can change, add, and remove items in a list after it
has been created.
Allow Duplicates
Since lists are indexed, lists can have items with the same value
Tuple
Tuples are used to store multiple items in a single variable.
A tuple is a collection which is ordered and unchangeable.
Tuples are written with round brackets.
Ordered
When we say that tuples are ordered, it means that the items have a defined order, and that
order will not change.
Unchangeable
Tuples are unchangeable, meaning that we cannot change, add or remove items after the
tuple has been created.
Allow Duplicates
Since tuples are indexed, they can have items with the same value.
Dictionary
Dictionaries are used to store data values in key:value pairs.
A dictionary is a collection which is ordered*, changeable and do not allow duplicate
Ordered or Unordered?
When we say that dictionaries are ordered, it means that the items have a defined order, and
that order will not change.
Unordered means that the items do not have a defined order, you cannot refer to an item by
using an index.
Changeable
Dictionaries are changeable, meaning that we can change, add or remove items after the
dictionary has been created.
Duplicates Not Allowed
Dictionaries cannot have two items with the same key.
Set
Sets are used to store multiple items in a single variable.
DAY 8[15-01-2024]

OBJECT-ORIENTED PROGRAMMING(OOP) IN PYTHON


In Python, object-oriented Programming (OOPs) is a programming paradigm that uses
objects and classes in programming. It aims to implement real-world entities like inheritance,
polymorphisms, encapsulation, etc. in the programming. The main concept of OOPs is to bind
the data and the functions that work on that together as a single unit so that no other part of the
code can access this data.
OOPs Concepts in Python
 Class
 Objects
 Polymorphism
 Encapsulation
 Inheritance
 Data Abstraction
Python Class
A class is a collection of objects. A class contains the blueprints or the prototype from
which the objects are being created. It is a logical entity that contains some attributes and
methods.
Python Objects
The object is an entity that has a state and behavior associated with it. It may be any real-
world object like a mouse, keyboard, chair, table, pen, etc. Integers, strings, floating-point
numbers, even arrays, and dictionaries, are all objects. More specifically, any single integer or
any single string is an object.
Python Inheritance
Inheritance is the capability of one class to derive or inherit the properties from another
class. The class that derives properties is called the derived class or child class and the class
from which the properties are being derived is called the base class or parent class.
Python Polymorphism
Polymorphism simply means having many forms. For example, we need to determine if
the given species of birds fly or not, using polymorphism we can do this using a single
function.
Python Encapsulation
Encapsulation is one of the fundamental concepts in object-oriented programming
(OOP). It describes the idea of wrapping data and the methods that work on data within one
unit. This puts restrictions on accessing variables and methods directly and can prevent the
accidental modification of data. To prevent accidental change, an object’s variable can only be
changed by an object’s method. Those types of variables are known as private variables.
Data Abstraction
It hides unnecessary code details from the user. Also, when we do not want to give
out sensitive parts of our code implementation and this is where data abstraction came.
DAY 9[16-01-2024]

FILE HANDLING
File handling is an important part of any web application.
Python has several functions for creating, reading, updating, and deleting files.
File Handling
The key function for working with files in Python is the open() function.
The open() function takes two parameters; filename, and mode.
Open a File
The open() function returns a file object, which has a read() method for reading the content
of the file the read() method returns the whole text, but you can also specify how many characters
you want to return
Read Lines
You can return one line by using the readline() methodTo write to an existing file, you
must add a parameter to the open() function:
"a" - Append - will append to the end of the file
"w" - Write - will overwrite any existing content
Create a New File
To create a new file in Python, use the open() method, with one of the following parameters:
"x" - Create - will create a file, returns an error if the file exist
"a" - Append - will create a file if the specified file does not exist
"w" - Write - will create a file if the specified file does not exist
Delete a File
To delete a file, you must import the OS module, and run its os.remove() function
DAY 10 [17-01-2024]

PYTHON LIBRARIES AND PACKAGES


Pandas
 Pandas is a Python library used for working with data sets.
 It has functions for analyzing, cleaning, exploring, and manipulating data.
 The name "Pandas" has a reference to both "Panel Data", and "Python Data
Analysis" and was created by Wes McKinney in 2008.
NumPy
 NumPy is a Python library used for working with arrays.
 It also has functions for working in domain of linear algebra, fourier transform,
and matrices.
 NumPy was created in 2005 by Travis Oliphant. It is an open source project and
you can use it freely.
 NumPy stands for Numerical Python.
SciPy
 SciPy is a scientific computation library that uses NumPy underneath.
 SciPy stands for Scientific Python.
 It provides more utility functions for optimization, stats and signal processing.
 Like NumPy, SciPy is open source so we can use it freely.
 SciPy was created by NumPy's creator Travis Olliphant.
Matplotlib
 Matplotlib is a low level graph plotting library in python that serves as a
visualization utility.
 Matplotlib was created by John D. Hunter.
 Matplotlib is open source and we can use it freely.
 Matplotlib is mostly written in python, a few segments are written in C,
Objective-C and Javascript for Platform compatibility.
DAY 11 [18-01-2024]

VERSION CONTROL AND COLLABRATION


There are three types in Vision Control:
 Local Vision Control
 Centralized Vision Control
 Distributed Vision Control
Local Version Control System
 A local version control system is a local database located on your local
computer, in which every file change is stored as a patch.
 Every patch set contains only the changes made to the file since its last
version. In order to see what the file looked like at any given moment, it is
necessary to add up all the relevant patches to the file in order until that given
moment.
Centralized Version Control System
 A centralized version control system has a single server that contains
all the file versions.
 This enables multiple clients to simultaneously access files on the
server, pull them to their local computer or push them onto the server from their
local computer.
 This way, everyone usually knows what everyone else on the project is
doing. Administrators have control over who can do what.
Distributed Version Control System
 Thus, everyone collaborating on a project owns a local copy of the
whole project,
i.e. owns their own local database with their own complete history.
 With this model, if the server becomes unavailable or dies, any of the
client
repositories can send a copy of the project's version to any other client or back onto the
server when it becomes available.
 It is enough that one client contains a correct copy which can then
easily be further distributed
DAY 12 [19-01-2024]

MACHINE LEARNING

Machine Learning is making the computer learn from studying data


and statistics. Machine Learning is a step into the direction of artificial intelligence
(AI).
Machine Learning is a program that analyses data and learns to predict the outcome
Where To Start?
In this tutorial we will go back to mathematics and study statistics, and
how to calculate important numbers based on data sets.
We will also learn how to use various Python modules to get the
answers we need.
And we will learn how to make functions that are able to predict the
outcome based on what we have learned.
Deep Learning:
TensorFlow and Keras: TensorFlow is an open-source machine learning library, and Keras
is a high-level neural networks API that runs on top of TensorFlow. PyTorch: An open-source deep
learning framework that provides dynamic computational graphs.

Natural Language Processing (NLP):


NLTK (Natural Language Toolkit):
A library for working with human language data (text).
spaCy:
An open-source library for advanced natural language processing in Python.
Transformers (Hugging Face):
A library for state-of-the-art Natural Language Understanding
(NLU) and Natural Language Generation (NLG)
DAY 13-16 [22-01-2024 - 25-01-2024]

MACHINE LEARNING ALGORITHM


This Machine learning Algorithms article will cover all the essential
algorithms of machine learning like Support vector machine, decision-making, logistics
regression, naive bayees classifier, random forest, k-mean clustering, reinforcement
learning, vector, hierarchical clustering, xgboost, adaboost, logistics, etc.
There are three types of machine learning algorithms.
 Supervised Learning
 Unsupervised Learning
 Reinforcement Learning

Supervised Learning Algorithm


Supervised learning is a type of machine learning algorithms where we used
labeled dataset to train the model or algorithms. The goal of the algorithm is to learn a
mapping from the input data to the output labels, allowing it to make predictions or
classifications on new, unseen data
Unsupervised Learning Algorithm
Unsupervised Learning is a type of machine learning algorithms where the
algorithms are used to find the patterns, structure or relationship within a dataset using
unlabled dataset. It explores the data’s inherent structure without predefined categories
or labels.
Reinforcement Learning
Reinforcement Learning is a type of machine learning algorithms where an agent
learns to make successive decisions by interacting with its surroundings. The agent
receives the feedback in the form of incentives or punishments based on its actions. The
agent’s purpose is to discover optimal tactics that maximize cumulative rewards over
time through trial and error. Reinforcement learning is frequently employed in
scenarios in which the agent must learn how to navigate an environment, play games,
manage robots, or make judgments in uncertain situations.
DAY 17 [26-01-2024]

Data Preprocessing in Machine learning


Data preprocessing is a process of preparing the raw data and making it suitable for
a machine learning model. It is the first and crucial step while creating a machine
learning model.
When creating a machine learning project, it is not always a case that we come
across the clean and formatted data. And while doing any operation with data, it is
mandatory to clean it and put in a formatted way.So for this, we use data preprocessing
task.
Why do we need Data Preprocessing?
A real-world data generally contains noises, missing values, and maybe in an
unusable format which cannot be directly used for machine learning models. Data
preprocessing is required tasks for cleaning the data and making it suitable for a
machine learning model which also increases the accuracy and efficiency of a machine
learning model.
What is a CSV File?
CSV stands for "Comma-Separated Values" files; it is a file format which allows
us to save the tabular data, such asspreadsheets. It is useful for huge datasets and can
use these datasets in programs.
Here we will use a demo dataset for data preprocessing, and for practice, it can be
downloaded from here, "https://www.superdatascience.com/pages/machine-learning.
For real-world problems, we can download datasets online from various sources such
as https://www.kaggle.com/uciml/datasets, https://archive.ics.uci.edu/ml/index.php etc.
We can also create our dataset by gathering data using various API with
Python and put that data into a .csv file.
DAY 18 [29-01-2024]

Data Visualization
In today’s world, a lot of data is being generated on a daily basis. And sometimes
to analyze this data for certain trends, patterns may become difficult if the data is in its
raw format. To overcome this data visualization comes into play. Data visualization
provides a good, organized pictorial representation of the data which makes it easier to
understand, observe, analyze. In this tutorial, we will discuss how to visualize data
using Python.
Python provides various libraries that come with different features
for visualizing data. All these libraries come with different features
and can support various types of graphs. In this tutorial, we will be discussing four such
libraries.
 Matplotlib
 Seaborn
 Bokeh
 Plotly

DAY 19[30-01-2024]

Data Analysis
What is Data Analysis?
Before jumping into the term “Data Analysis”, let’s discuss the term “Analysis”.
Analysis is a process of answering “How?” and “Why?”. For example, how was
the growth of XYZ Company in the last quarter? Or why did the sales of XYZ
Company drop last summer? So to answer those questions we take the data that we
already have. Out of that, we filter out what we need. This filtered data is the final
dataset of the larger chunk that we have already collected and that becomes the target
of data analysis. Sometimes we take multiple data sets and analyze them to find a
pattern.
For example, take summer sales data for three consecutive years. I found out if that
fall in sales last summer was because of any specific product that we were selling or if
it was just a recurring problem. It’s all about looking for a pattern. We analyze things or
events that have already happened in the past.
Why Data Analysis is important?
Let’s say you own a business and sell daily products. Your business model is
pretty simple. You buy products from the supplier and sell them to the customer.
Let’s assume the biggest challenge for your business is to find the right amount of
stock at the given time. You can’t stock excess dairy products as they are perishable
and if they go bad you can’t sell them, resulting in a direct loss for you. At the same
time, you can not understock as it may result in the loss of potential customers. But data
analytics can help you in predicting the strength of your customers at a given time.
Using that result, you can sufficiently stock your supplies, in turn, minimizing the loss.
In simple words, using data analysis, you can find out the time of the year when your
store has the least or the most customers. Using this info, you can stock your supplies
accordingly.

DAY 22 [02-02-2024]

Project Report

Objective
Classification Model to Identify Employee Attrition Project
Dataset description
Dataset source -
https://github.com/ybifoundation/Dataset/raw/main/EmployeeAttrition.csv
Dataset variables
1. AGE :
Numerical Value
2. ATTRITION : Employee leaving the company (0=no, 1=yes)
3. BUSINESS TRAVEL
: (1=No Travel, 2=Travel Frequently, 3=Tavel Rarely)
4. DAILY RATE : Numerical Value - Salary Level
5. DEPARTMENT :
(1=HR, 2=R&D, 3=Sales)
6. DISTANCE FROM HOME :
Numerical Value - THE DISTANCE FROM WORK TO HOME
7. EDUCATION Numerical Value
8. EDUCATION FIELD
(1=HR, 2=LIFE SCIENCES, 3=MARKETING, 4=MEDICAL SCIENCES, 5=OTHERS, 6=
TEHCNICAL)
9. EMPLOYEE COUNT
Numerical Value 10. EMPLOYEE NUMBER Numerical Value - EMPLOYEE ID
11. ENVIROMENT SATISFACTION Numerical Value - SATISFACTION WITH THE
ENVIROMENT
12. GENDER
(1=FEMALE, 2=MALE)
13. HOURLY RATE
Numerical Value - HOURLY SALARY
14. JOB INVOLVEMENT Numerical Value - JOB INVOLVEMENT
15. JOB LEVEL Numerical Value - LEVEL OF JOB
16. JOB ROLE (1=HC REP, 2=HR, 3=LAB TECHNICIAN, 4=MANAGER, 5= MANAGING
DIRECTOR, 6= REASEARCH
DIRECTOR, 7= RESEARCH SCIENTIST, 8=SALES EXECUTIEVE, 9= SALES
REPRESENTATIVE)
17. JOB SATISFACTION Numerical Value - SATISFACTION WITH THE JOB
18. MARITAL STATUS
(1=DIVORCED, 2=MARRIED, 3=SINGLE)
19. MONTHLY INCOME
20. MONTHY RATE
Numerical Value - MONTHLY SALARY
Numerical Value - MONTHY RATE
21. NUMCOMPANIES WORKED
Numerical Value - NO. OF COMPANIES WORKED AT
22. OVER 18 (1=YES, 2=NO)
23. OVERTIME (1=NO, 2=YES)
24. PERCENT SALARY HIKE 25. PERFORMANCE RATING
Numerical Value - PERCENTAGE INCREASE IN SALARY
Numerical Value - PERFORMANCE RATING
26. RELATIONS SATISFACTION Numerical Value - RELATIONS SATISFACTION
27. STANDARD HOURS
Numerical Value - STANDARD HOURS
28. STOCK OPTIONS LEVEL
Numerical Value - STOCK OPTIONS
29. TOTAL WORKING YEARS
Numerical Value - TOTAL YEARS WORKED
30. TRAINING TIMES LAST YEAR Numerical Value - HOURS SPENT TRAINING
31. WORK LIFE BALANCE Numerical Value - TIME SPENT BEWTWEEN WORK AND
OUTSIDE
32. YEARS AT COMPANY Numerical Value - TOTAL NUMBER OF YEARS AT THE
COMPNAY
33. YEARS IN CURRENT ROLE
Numerical Value -YEARS IN 34. CURRENT ROLE
34. YEARS SINCE LAST PROMOTION
Numerical Value - LAST PROMOTION
35. YEARS WITH CURRENT MANAGER
Numerical Value - YEARS SPENT WITH CURRENT MANAGER

You might also like