Divya Report (2) Desktop Final Edit 2
Divya Report (2) Desktop Final Edit 2
ADVANCED PYTHON
is submitted in partial fulfillment of the requirement (III B.Tech Summer Break) for the award
of the Degree of Bachelor of Technology
to
P.DIVYA
(19711A0488)
2022-2023
Department of Electronics and Communication Engineering
CERTIFICATE
1.
2.
DECLARATION
I hereby declare that the internship entitled ADVANCED PYTHON has been
done by me and has submitted to NARAYANA ENGINEERING COLLEGE,
NELLORE as a part of partial fulfillment of the requirements for the award of degree
of Bachelor of Technology in Department of Electronics and Communication
Engineering.
I also declare that this internship report has not submitted to any other institute
or university and not copied from any other sources.
P.DIVYA
(19711A0488 )
Place: NELLORE
Date:
CERTIFICATION
ACKNOWLEDGEMENT
I would like to thank my Head of the Department Dr. K. Murali M.Tech, Ph.D,
Professor & HOD, Department of Electronics and Communication Engineering, Narayana
Engineering College, Nellore for his constructive criticism throughout my internship.
P. DIVYA
(19711A0488)
ABSTRACT
I
Organization Information / Industry Profile
Pan Tech e- Learning is one of the growing IT services companies. Pan Tech e-
Learning started in 17 February, 2021 as Proprietor Entity with a vision of providing
web services and hosting servers at affordable cost.
PANTECH ELEARNING PRIVATE LIMITED is classified as Non-govt company
and is registered at Registrar of Companies located in ROC-CHENNAI.
As regarding the financial status on the time of registration of PANTECH
ELEARNING PRIVATE LIMITED Company its authorized share capital is Rs.
1500000 and its paid-up capital is Rs. 100000.
We provide complete end-to-end outsourcing solutions for various industries. We
have a comprehensive set of solutions for the Educational Institutes, banking, finance,
insurance, manufacturing, retail & distribution and contracting sectors.
The company has operations and a customer base spanning across 8 countries
including software.
II
Learning Objectives / Internship Objectives
Internships are generally thought of to be reserved for college students looking to gain
experience in a particular field. However, a wide array of people can benefit from
Training Internships in order to receive real world experience and develop their skills.
An objective for this position should emphasize the skills you already possess in the area
and your interest in learning more
Internships are utilized in a number of different career fields, including architecture,
engineering, healthcare, economics, advertising and many more.
Some internship is used to allow individuals to perform scientific research while others
are specifically designed to allow people to gain first-hand experience working.
Utilizing internships is a great way to build your resume and develop skills that can be
emphasized in your resume for future jobs. When you are applying for a Training
Internship, make sure to highlight any special skills or talents that can make you stand
apart from the rest of the applicants so that you have an improved chance of landing the
position.
III
Weekly Overview of Internship Activities
IV
SUMMARY OF THE TOPIC/MODULE
WEEK DATE DAY
COMPLETED
26-09-2022 Monday Pandas Tutorial
28-09-2022 Wednesday Introduction to Pandas in Python
3rd WEEK
V
INDEX
VI
2.3. Detection of Credit Card Fraud 14
VII
List of Figures
NAME PAGE NO
Figure 3.1. Block Diagram of the Project 16
Figure 3.2. Pie Chart of genuine and fraud cases 22
Figure 3.3. ROC Curve Analysis 23
VIII
List of Tables
NAME PAGE NO
Table 1.1 Arithmetic Operators 3
Table 1.2 Comparison Operators 4
Table 1.3 Assignment Operators 5
Table 1.4 Bitwise Operators 6
Table 1.5 Logical Operators 7
IX
CHAPTER-1
INTRODUCTION
A well-liked programming language is Python. In 1991, Guido van Rossum produced it,
and it became available.
Purpose :
Uses of 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 operates on an interpreter system, allowing for the immediate execution
of written code. As a result, prototyping can proceed quickly.
Python can be used in a functional, object-oriented, or procedural manner.
DATATYPES
Python has the following data types built-in by default, in these categories:
You can get the data type of any object by using the type() function:
x=5
print(type(x))
OPERATORS
Arithmetic Operators
Comparison (Relational) Operators
Assignment Operators
Logical Operators
Bitwise Operators
- Subtraction Subtracts right hand operand from left hand operand. a–b=-
10
% Modulus Divides left hand operand by right hand operand and returns b%a=
remainder 0
<> If values of two operands are not equal, then condition (a <> b)
becomes true. is true.
This is
similar
to !=
operator.
> If the value of left operand is greater than the value of right (a > b) is
operand, then condition becomes true. not true.
< If the value of left operand is less than the value of right (a < b) is
operand, then condition becomes true. true.
>= If the value of left operand is greater than or equal to the (a >= b)
value of right operand, then condition becomes true. is not
true.
<= If the value of left operand is less than or equal to the value (a <= b)
of right operand, then condition becomes true. is true.
+= Add AND It adds right operand to the left operand and assign c += a is
the result to left operand equivalent
to c = c +
a
& Binary AND Operator copies a bit to the result if it exists in (a & b)
both operands (means
0000 1100)
<< Binary Left The left operands value is moved left by the a << 2 =
Shift number of bits specified by the right operand. 240 (means
1111 0000)
>> Binary Right The left operands value is moved right by the a >> 2 = 15
Shift number of bits specified by the right operand. (means
0000 1111)
and Logical If both the operands are true then condition becomes (a and b)
AND true. is true.
not Logical Used to reverse the logical state of its operand. Not(a
NOT and b) is
false.
1.3 LOOPS
Loops are a crucial part of programming and are found in practically all programming
languages (Python, C, R, Visual Basic etc.). It is employed to repeatedly do one or
more actions up until a specified condition is met. It's primarily employed to automate
Dept. of ECE Narayana Engineering College, Nellore
routine tasks.
Code is constantly run through a while loop until a condition is met. And the
line in the programme that comes just after the loop is run when the condition changes
to false.
Program to print numbers from 1 to 5:
i=1
while (i<6):
print(i)
i+=1
output:
1
2
3
4
5
1.4 FUNCTIONS
A function is a section of code that only executes when called. You can supply
parameters—data—to a function. As a result, a function may return data.
Example:
Calling a Function
Example:
Create a Class
Example
class MyClass:
x=5
Create Object
Example
Syntax
Here is simple syntax of try....except...else blocks –
try:
You do your operations here;
except Exception I:
If there is Exception I, then execute this block.
except Exception II:
If there is Exception I, then execute this block.
else:
If there is no Exception then execute this block.
File handling is an important part of any web application. Python has several
functions for creating, reading, updating, and deleting files.
“r” – Read – Default value. Opens a file for reading, error if the file does not exist
“a” – Append – Opens a file for appending, creates the file if it does not exist
“w” – Write – Opens a file for writing, creates the file if it does not exist
“x”- Create - Creates the specified file, returns an error if the file exists
Dept. of ECE Narayana Engineering College, Nellore
“t” - Text - Default value. Text mode
Syntax
To open a file for reading it is enough to specify the name of the file:
f = open("demofile.txt")
Because "r" for read, and "t" for text are the default values, you do not need to
specify them.
CHAPTER-2
METHODOLOGY
The Python package NumPy is used to manipulate arrays. Additionally, it has matrices,
Fourier transform, and functions for working in the area of linear algebra. In the year
2005, Travis Oliphant developed NumPy. You can use it for free because it is an open-
source project. Numerical Python is referred to as NumPy.
Example :
import numpy as np
print(arr)
print(type(arr))
To create an ndarray, we can pass a list, tuple or any array-like object into
the array() method, and it will be converted into an ndarray:
Example:
import numpy as np
print(arr)
2.1.1 Data Types in NumPy
NumPy has some extra data types, and refer to data types with one
character, like i for integers, u for unsigned integers etc.
Below is a list of all data types in NumPy and the characters used to represent them.
i - integer
b - boolean
u - unsigned integer
f - float
c - complex float
m - timedelta
M - datetime
O - object
Python's Pandas package is used to manipulate data sets. It offers tools for data
exploration, cleaning, analysis, and manipulation.
With the aid of Pandas, we can examine large data sets and draw conclusions based on
statistical principles. Pandas can organise disorganised data sets, making them readable
and useful. In data science, relevant data is crucial.
Pandas are also able to delete rows that are not relevant, or contains wrong values, like
empty or NULL values. This is called cleaning the data.
Installation of Pandas
If you have Python and PIP already installed on a system, then installation
of Pandas is very easy.
Import Pandas
import pandas
Example:
import pandas
Pandas as pd
Pandas is usually imported under the pd alias. Create an alias with the as keyword
while importing:
import pandas as pd
Example:
import pandas as pd
Example:
import pandas as pd
print(pd.__version__)
When the world was under lockdown and movement was restricted to an
absolute emergency- millions were introduced to the world of online shopping. The
convenience of online shopping helped e-commerce platforms record historic sales.
While that happened, it is no surprise that the rate of online financial fraud also
increased incredibly. Online fraud cases using credit and debit cards saw a historic
There are several categories of credit card fraud that are prevalent in today’s time
Lost/Stolen cards: People steal credit cards from the mail and use them
illegally on behalf of the owner. The process of blocking credit cards that have
been stolen and re-issuing them is a hassle for both customers and credit card
companies.
Card Abuse: The customer buys goods and items on the credit card but has no
intention to pay back the amount charged by the bank for the same. These
customers stop answering the calls as the deadline to settle the dues approaches.
Identity Theft: The customers apply illegitimate information, and they might
even steal the details of a genuine customer to apply for a credit card and then
misuse it. In such cases, even card blocking can not stop the credit card from
falling into the wrong hands.
CHAPTER-3
STEPS FOR EXECUTING THE PROJECT
1. Introduction.
2. Credit Card Fraud Detection Dataset.
3. Data Exploration and Visualization.
4. Data Preparation.
5. Building and Training the Model.
6. Undersampling. NearMiss Methods.
7. Oversampling with SMOTE.
8. Appendix: Outlier Detection and Removal.
# Importing modules
import numpy as np
import pandas as pd
dataset = pd.read_csv("creditcard.csv")
data_p = dataset.copy()
data_plot = dataset.copy()
amount = data_plot['Amount']
columns = data_plot.iloc[:,0:30].columns
plt.figure(figsize=(12,30*4))
grids = gridspec.GridSpec(30, 1)
ax = plt.subplot(grids[grid])
ax.set_xlabel("")
dataset.isnull().shape[0]
# Separate response and features Undersampling before cross validation will lead to
overfiting
y = dataset["Class"] # target
X = dataset.iloc[:,0:30]
rfc = RandomForestClassifier()
rfc.fit(X_train, y_train)
y_pred = rfc.predict(X_test)
# For the performance let's use some metrics from SKLEARN module
CHAPTER-5
CONCLUSION
A business can suffer sudden, significant damages from only one fraud attack, not just
customers, and possibly have legal repercussions. According to the proverb, prevention
Dept. of ECE Narayana Engineering College, Nellore
is always preferable to treatment.
CHAPTER-7
REFERENCES
[1] “Credit Card Fraud Detection: A Novel Approach Using Aggregation Strategy and
Feedback Mechanism.” IEEE Internet of Things Journal 5
[3] “Supervised Machine Learning Algorithms for Credit Card Fraudulent Transaction
Detection: A Comparative Study.”
[4]“Credit Card Fraud Detection Using AdaBoost and Majority Voting.” IEEE Access.
[6]Xuan, Shiyang, et al. “Random Forest for Credit Card Fraud Detection.” 2018 IEEE
15th International Conference on Networking, Sensing and Control (ICNSC).
[7]Awoyemi, John O., et al. “Credit Card Fraud Detection Using Machine Learning
Techniques: A Comparative Analysis.”
“Plastic C