xii IP sample report

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 54

Project Title

A
Project Report

Submitted in partial fulfillment of the requirement for the

SENIOR SECONDARY EXAMINATION (AISSCE)

Submitted To

[CENTRAL BOARD SECONDARY EDUCATION]


Submitted By
Student name
Roll No -___________________

Under The Supervision Of:

Mr. Ashutosh Rajguru


(PGT IP)
Department of Information Technology
St. Thomas Sr. Sec. School, Mandsaur (M.P.)

DEPARTMENT OF INFORMATION TECHNOLOGY


ST. THOMAS SR. SEC. SCHOOL, MANDSAUR
CERTIFICATE .

This is to certify that the project titled “”STUDENT INFO


SYSTEM”” submitted by Miss/Master PRATHAM
KOTHARI having roll no ________ of CLASS XII “D”
has completed this project for partial rollback in full-fillment
of the requirement for the senior secondary examination
(AISSCE) embodies the bonafide work done by him/her
under my supervision.

Internal Supervisor External Supervisor


Mr. Ashutosh Rajguru

Principal

Sr. Jyothis CMC


ID – SHEET

Roll No :

Name of Student :

Address :

Phone No :

Email Address :

Supervisor : Mr. Ashutosh Rajguru


(PGT IP)

Project Title :

Front End Tool : Python 3.7


(ANACONDA/PYTHON IDLE)

Back End Tool : MYSQL 5.5 /CSV


ACKNOWLEDGEMENT

Apart from the efforts of me, the success of any project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my
gratitude to the people who have been instrumental in the successful completion of this
project.
I express deep sense of gratitude to almighty God for giving me strength for the
successful completion of the project.

I express my heartfelt gratitude to my parents for constant encouragement while


carrying out this project.

I gratefully acknowledge the contribution of the individuals who contributed in


bringing this project up to this level, who continues to look after me despite my flaws,

I express my deep sense of gratitude to the luminary The Principal, “Sr.


Jyothis(CMC)” who has been continuously motivating and extending their helping
hand to us.
I express my sincere thanks to The Class Teacher, “Mr. Venugopalan Nair”, for
constant encouragement and the guidance provided during this project

My sincere thanks to “Mr. Ashutosh Rajguru”, Master In-charge, A guide, Mentor all
the above a friend, who critically reviewed my project and helped in solving each and
every problem, occurred during implementation of the project
The guidance and support received from all the members who contributed and
who are contributing to this project, was vital for the success of the project. I am grateful
for their constant support and help.
TABLE OF CONTENTS

 Introduction

 Python Details

 Preliminary Design

 Database Design

 Implementation

 Bibliography
INTRODUCTION

“STOCK MANAGEMENT" Stock management is the function of

understanding the stock mix of a company and the different demands on that stock. The

demands are influenced by both external and internal factors and are balanced by the

creation of purchase order requests to keep supplies at a reasonable or prescribed level.

Stock management is important for every other business enterprise.

OBJECTIVES OF THE PROJECT

The objective of this project is to let the students apply the programming
knowledge into a real- world situation/problem and exposed the students how
programming skills helps in developing a good software.

1. Write programs utilizing modern software tools.


2. Apply object oriented programming principles effectively when developing small
to medium sized projects.

3. Write effective procedural code to solve small to medium sized problems.

4. Students will demonstrate a breadth of knowledge in computer science, as exem-


plified in the areas of systems, theory and software development.

5. Students will demonstrate ability to conduct a research or applied Computer Sci-


ence project, requiring writing and presentation skills which exemplify scholarly
style in computer science.

PROPOSED SYSTEM

Today one cannot afford to rely on the fallible human beings of be really wants to

stand against today’s merciless competition where not to wise saying “to err is
human” no longer valid, it’s out dated to rationalize your mistake. So, to keep pace

with time, to bring about the best result without malfunctioning and greater efficiency so

to replace the unending heaps of flies with a much sophisticated hard disk of the

computer.

One has to use the data management software. Software has been an ascent in

atomization various organisations. Many software products working are now in markets,

which have helped in making the organizations work easier and efficiently. Data

management initially had to maintain a lot of ledgers and a lot of paperwork has to be

done but now software product on this organization has made their work faster and

easier. Now only this software has to be loaded on the computer and work can be done.

This prevents a lot of time and money. The work becomes fully automated and

any information regarding the organization can be obtained by clicking the button.

Moreover, now it’s an age of computers of and automating such an organization gives

the better look.

SYSTEM DEVELOPMENT LIFE CYCLE (SDLC)


The systems development life cycle is a project management technique that
divides complex projects into smaller, more easily managed segments or phases.
Segmenting projects allows managers to verify the successful completion of project
phases before allocating resources to subsequent phases.
Software development projects typically include initiation, planning, design,
development, testing, implementation, and maintenance phases. However, the phases
may be divided differently depending on the organization involved.
For example, initial project activities might be designated as request,
requirements-definition, and planning phases, or initiation, concept-development, and
planning phases. End users of the system under development should be involved in
reviewing the output of each phase to ensure the system is being built to deliver the
needed functionality.
PHASES OF SYSTEM DEVELOPMENT LIFE CYCLE

INITIATION PHASE

The Initiation Phase begins when a business sponsor identifies a need or an opportunity.
The purpose of the Initiation Phase is to:

Identify and validate an opportunity to improve business accomplishments of the


organization or a deficiency related to a business need.
Identify significant assumptions and constraints on solutions to that need.
Recommend the exploration of alternative concepts and methods to satisfy the
need including questioning the need for technology, i.e., will a change in the busi-
ness process offer a solution?
Assure executive business and executive technical sponsorship. The Sponsor des-
ignates a Project Manager and the business need is documented in a Concept Pro-
posal. The Concept Proposal includes information about the business process and
the relationship to the Agency/Organization.
Infrastructure and the Strategic Plan. A successful Concept Proposal results in a
Project Management Charter which outlines the authority of the project manager
to begin the project.
Careful oversight is required to ensure projects support strategic business
objectives and resources are effectively implemented into an organization's enterprise
architecture. The initiation phase begins when an opportunity to add, improve, or correct
a system is identified and formally requested through the presentation of a business case.
The business case should, at a minimum, describe a proposal’s purpose, identify
expected benefits, and explain how the proposed system supports one of the
organization’s business strategies. The business case should also identify alternative
solutions and detail as many informational, functional, and network requirements as
possible.
SYSTEM CONCEPT DEVELOPMENT PHASE

The System Concept Development Phase begins after a business need or opportunity is
validated by the Agency/Organization Program Leadership and the Agency/Organization
CIO.
The purpose of the System Concept Development Phase is to:
Determine the feasibility and appropriateness of the alternatives.
Identify system interfaces.
Identify basic functional and data requirements to satisfy the business need.
Establish system boundaries; identify goals, objectives, critical success factors,
and performance measures.
Evaluate costs and benefits of alternative approaches to satisfy the basic func-
tional requirements
Assess project risks
Identify and initiate risk mitigation actions, andDevelop high-level technical ar-
chitecture, process models, data models, and a concept of operations. This phase
explores potential technical solutions within the context of the business need.
It may include several trade-off decisions such as the decision to use COTS soft-
ware products as opposed to developing custom software or reusing software
components, or the decision to use an incremental delivery versus a complete,
onetime deployment.
Construction of executable prototypes is encouraged to evaluate technology to
support the business process. The System Boundary Document serves as an im-
portant reference document to support the Information Technology Project Re-
quest (ITPR) process.
The ITPR must be approved by the State CIO before the project can move for-
ward.

PICTORIAL
REPRESENTATION OF
SDLC:
PLANNING PHASE

The planning phase is the most critical step in completing development,


acquisition, and maintenance projects. Careful planning, particularly in the early stages
of a project, is necessary to coordinate activities and manage project risks effectively.
The depth and formality of project plans should be commensurate with the
characteristics and risks of a given project. Project plans refine the information gathered
during the initiation phase by further identifying the specific activities and resources
required to complete a project.
A critical part of a project manager’s job is to coordinate discussions between
user, audit, security, design, development, and network personnel to identify and
document as many functional, security, and network requirements as possible. During
this phase, a plan is developed that documents the approach to be used and includes a
discussion of methods, tools, tasks, resources, project schedules, and user input.
Personnel assignments, costs, project schedule, and target dates are established.
A Project Management Plan is created with components related to acquisition
planning, configuration management planning, quality assurance planning, concept of
operations, system security, verification and validation, and systems engineering
management planning.

REQUIREMENTS ANALYSISPHASE
This phase formally defines the detailed functional user requirements using high-
level requirements identified in the Initiation, System Concept, and Planning phases. It
also delineates the requirements in terms of data, system performance, security, and
maintainability requirements for the system. The requirements are defined in this phase
to a level of detail sufficient for systems design to proceed. They need to be measurable,
testable, and relate to the business need or opportunity identified in the Initiation Phase.
The requirements that will be used to determine acceptance of the system are captured in
the Test and Evaluation Master Plan.

The purposes of this phase are to:

Further define and refine the functional and data requirements and document them
in the Requirements Document,
Complete business process reengineering of the functions to be supported (i.e.,
verify what information drives the business process, what information is gener-
ated, who generates it, where does the information go, and who processes it),
Develop detailed data and process models (system inputs, outputs, and the pro-
cess.
Develop the test and evaluation requirements that will be used to determine ac-
ceptable system performance.
DESIGN PHASE

The design phase involves converting the informational, functional, and network
requirements identified during the initiation and planning phases into unified design
specifications that developers use to script programs during the development phase.
Program designs are constructed in various ways. Using a top-down approach, designers
first identify and link major program components and interfaces, then expand design
layouts as they identify and link smaller subsystems and connections. Using a bottom-up
approach, designers first identify and link minor program components and interfaces,
then expand design layouts as they identify and link larger systems and connections.
Contemporary design techniques often use prototyping tools that build mock-up designs
of items such as application screens, database layouts, and system architectures. End
users, designers, developers, database managers, and network administrators should
review and refine the prototyped designs in an iterative process until they agree on an
acceptable design. Audit, security, and quality assurance personnel should be involved in
the review and approval process. During this phase, the system is designed to satisfy the
functional requirements identified in the previous phase. Since problems in the design
phase could be very expensive to solve in the later stage of the software development, a
variety of elements are considered in the design to mitigate risk. These include:

Identifying potential risks and defining mitigating design features.


Performing a security risk assessment.
Developing a conversion plan to migrate current data to the new system.
Determining the operating environment.
Defining major subsystems and their inputs and outputs.
Allocating processes to resources.
Preparing detailed logic specifications for each software module. The result is a
draft System Design Document which captures the preliminary design for the sys-
tem.
Everything requiring user input or approval is documented and reviewed by the
user. Once these documents have been approved by the Agency CIO and Business
Sponsor, the final System Design Document is created to serve as the Critical/De-
tailed Design for the system.
This document receives a rigorous review by Agency technical and functional rep-
resentatives to ensure that it satisfies the business requirements. Concurrent with
the development of the system design, the Agency Project Manager begins devel-
opment of the Implementation Plan, Operations and Maintenance Manual, and the
Training Plan.

DEVELOPMENT PHASE

The development phase involves converting design specifications into


executable programs. Effective development standards include requirements that
programmers and other project participants discuss design specifications before
programming begins. The procedures help ensure programmers clearly understand
program designs and functional requirements. Programmers use various techniques to
develop computer programs. The large transaction oriented programs associated with
financial institutions have traditionally been developed using procedural
programming techniques. Procedural programming involves the line-by-line scripting
of logical instructions that are combined to form a program. Effective completion of
the previous stages is a key factor in the success of the Development phase. The
Development phase consists of:

Translating the detailed requirements and design into system components.


Testing individual elements (units) for usability.
Preparing for integration and testing of the IT system.

INTEGRATION AND TEST PHASE

Subsystem integration, system, security, and user acceptance testing is conducted


during the integration and test phase. The user, with those responsible for quality
assurance, validates that the functional requirements, as defined in the functional
requirements document, are satisfied by the developed or modified system. OIT
Security staff assesses the system security and issue a security certification and
accreditation prior to installation/implementation.

Multiple levels of testing are performed, including:

Testing at the development facility by the contractor and possibly supported by


end users

Testing as a deployed system with end users working together with contract per-
sonnel

Operational testing by the end user alone performing all functions. Requirements
are traced throughout testing, a final Independent Verification & Validation evalu-
ation is performed and all documentation is reviewed and accepted prior to ac-
ceptance of the system.

IMPLEMENTATION PHASE

This phase is initiated after the system has been tested and accepted by the user. In
this phase, the system is installed to support the intended business functions. System
performance is compared to performance objectives established during the planning
phase. Implementation includes user notification, user training, installation of hardware,
installation of software onto production computers, and integration of the system into
daily work processes. This phase continues until the system is operating in production in
accordance with the defined user requirements.

OPERATIONS AND MAINTENANCE PHASE

The system operation is on-going. The system is monitored for continued


performance in accordance with user requirements and needed system modifications are
incorporated. Operations continue as long as the system can be effectively adapted to
respond to the organization’s needs. When modifications or changes are identified, the
system may renter the planning phase.

The purpose of this phase is to:

Operate, maintain, and enhance the system.


Certify that the system can process sensitive information.
Conduct periodic assessments of the system to ensure the functional requirements
continue to be satisfied.
Determine when the system needs to be modernized, replaced, or retired.
Python Introduction

Python is an interpreter, object-oriented, high-level programming language with


dynamic semantics. Its high-level built in data structures, combined with dynamic
typing and dynamic binding, make it very attractive for Rapid Application Development,
as well as for use as a scripting or glue language to connect existing components
together. Python's simple, easy to learn syntax emphasizes readability and therefore
reduces the cost of program maintenance. Python supports modules and packages,
which encourages program modularity and code reuse. The Python interpreter and the
extensive standard library are available in source or binary form without charge for all
major platforms, and can be freely distributed.

Often, programmers fall in love with Python because of the increased productivity it
provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast.
Debugging Python programs is easy: a bug or bad input will never cause a segmentation
fault. Instead, when the interpreter discovers an error, it raises an exception. When the
program doesn't catch the exception, the interpreter prints a stack trace. A source level
debugger allows inspection of local and global variables, evaluation of arbitrary
expressions, setting breakpoints, stepping through the code a line at a time, and so on.
The debugger is written in Python itself, testifying to Python's introspective power. On
the other hand, often the quickest way to debug a program is to add a few print
statements to the source: the fast edit-test-debug cycle makes this simple approach
very effective.

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 devel-
opment.

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.

Good to know
 The most recent major version of Python is Python 3, which we shall be using in
this tutorial. However, Python 2, although not being updated with anything other
than security updates, is still quite popular.
 In this tutorial Python will be written in a text editor. It is possible to write Python
in an Integrated Development Environment, such as Thonny, Pycharm, Netbeans
or Eclipse which are particularly useful when managing larger collections of Py-
thon files.

Python 2 vs. Python 3

Python is available in two versions, which are different enough to trip up many new
users. Python 2.x, the older “legacy” branch, will continue to be supported (that is,
receive official updates) through 2020, and it might persist unofficially after that. Python
3.x, the current and future incarnation of the language, has many useful and important
features not found in Python 2.x, such as new syntax features (e.g., the “walrus
operator”), better concurrency controls, and a more efficient interpreter.

Python 3 adoption was slowed for the longest time by the relative lack of third-party
library support. Many Python libraries supported only Python 2, making it difficult to
switch. But over the last couple of years, the number of libraries supporting only Python
2 has dwindled; all of the most popular libraries are now compatible with both Python 2
and Python 3. Today, Python 3 is the best choice for new projects; there is no reason to
pick Python 2 unless you have no choice. If you are stuck with Python 2, you have
various strategies at your disposal.

Python’s libraries

The success of Python rests on a rich ecosystem of first- and third-party software.
Python benefits from both a strong standard library and a generous assortment of easily
obtained and readily used libraries from third-party developers. Python has been
enriched by decades of expansion and contribution.

Python’s standard library provides modules for common programming tasks—math,


string handling, file and directory access, networking, asynchronous operations,
threading, multiprocess management, and so on. But it also includes modules that
manage common, high-level programming tasks needed by modern applications: reading
and writing structured file formats like JSON and XML, manipulating compressed files,
working with internet protocols and data formats (webpages, URLs, email). Most any
external code that exposes a C-compatible foreign function interface can be accessed
with Python’s ctypes module.

The default Python distribution also provides a rudimentary, but useful, cross-platform
GUI library via Tkinter, and an embedded copy of the SQLite 3 database.

The thousands of third-party libraries, available through the Python Package


Index (PyPI), constitute the strongest showcase for Python’s popularity and versatility.

For example:

 The BeautifulSoup library provides an all-in-one toolbox for scraping HTML—even


tricky, broken HTML—and extracting data from it.
 Requests makes working with HTTP requests at scale painless and simple.
 Frameworks like Flask and Django allow rapid development of web services that encom-
pass both simple and advanced use cases.
 Multiple cloud services can be managed through Python’s object model using Apache
Libcloud.
 NumPy, Pandas, and Matplotlib accelerate math and statistical operations, and make it
easy to create visualizations of data.

Inbuilt Data Structures in Python


 Last Updated : 04 Feb, 2021
Python has four basic inbuilt data structures namely Lists, Dictionary, Tuple and Set.
These almost cover 80% of the our real world data structures. This article will cover the
above mentioned topics.
Above mentioned topics are divided into four sections below.
Lists: Lists in Python are one of the most versatile collection object types available. The
other two types are dictionaries and tuples, but they are really more like variations of
lists.
 Python lists do the work of most of the collection data structures found in other lan-
guages and since they are built-in, you don’t have to worry about manually creating
them.
 Lists can be used for any type of object, from numbers and strings to more lists.
 They are accessed just like strings (e.g. slicing and concatenation) so they are simple
to use and they’re variable length, i.e. they grow and shrink automatically as
they’re used.
 In reality, Python lists are C arrays inside the Python interpreter and act just like an
array of pointers.
Dictionary: In python, dictionary is similar to hash or maps in other languages. It
consists of key value pairs. The value can be accessed by unique key in the dictionary.
 Keys are unique & immutable objects.
Syntax:
dictionary = {"key name": value}
Tuple : Python tuples work exactly like Python lists except they are immutable, i.e. they
can’t be
changed in place. They are normally written inside parentheses to distinguish them from
lists (which use square brackets), but as you’ll see, parentheses aren’t always
necessary. Since tuples are immutable, their length is fixed. To grow or shrink a tuple, a
new tuple must be created.
Here’s a list of commonly used tuples:
() An empty tuple
t1 = (0, ) A one-item tuple (not an expression)
t2 = (0, 1, 2, 3) A four-item tuple
t3 = 0, 1, 2, 3 Another four-item tuple (same as prior line, just minus the parenthesis)
t3 = (‘abc’, (‘def’, ‘ghi’)) Nested tuples
t1[n], t3[n][j] Index
t1[i:j], Slice
len(tl) Length

 Python3
filter_none
edit
play_arrow
brightness_4

# Python program to illustrate

# tuple

tup = (1, "a", "string", 1+2)


print (tup)

print (tup[1])

Output:
(1, 'a', 'string', 3)
a
Detailed article on Tuples in Python
Sets: Unordered collection of unique objects.
 Set operations such as union (|) , intersection(&), difference(-) can be applied on a
set.
 Frozen Sets are immutable i.e once created further data can’t be added to them
 {} are used to represent a set.Objects placed inside these brackets would be treated as
a set.
 Python
filter_none
edit
play_arrow
brightness_4

# Python program to demonstrate working of

# Set in Python

# Creating two sets

set1 = set()

set2 = set()

# Adding elements to set1

for i in range(1, 6):


set1.add(i)

# Adding elements to set2

for i in range(3, 8):

set2.add(i)

print("Set1 = ", set1)

print("Set2 = ", set2)

print("\n")

Output:
('Set1 = ', set([1, 2, 3, 4, 5]))
('Set2 = ', set([3, 4, 5, 6, 7]))
To read more about sets in python read our article about set by clicking here.
Attention geek! Strengthen your foundations with the Python Programming
Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with
the Python DS Course

Comparing Python to Other Languages


Python is often compared to other interpreted languages such as Java, JavaScript, Perl,
Tcl, or Smalltalk. Comparisons to C++, Common Lisp and Scheme can also be
enlightening. In this section I will briefly compare Python to each of these languages.
These comparisons concentrate on language issues only. In practice, the choice of a
programming language is often dictated by other real-world constraints such as cost,
availability, training, and prior investment, or even emotional attachment. Since these
aspects are highly variable, it seems a waste of time to consider them much for this
comparison.

Java
Python programs are generally expected to run slower than Java programs, but they also
take much less time to develop. Python programs are typically 3-5 times shorter than
equivalent Java programs. This difference can be attributed to Python's built-in high-
level data types and its dynamic typing. For example, a Python programmer wastes no
time declaring the types of arguments or variables, and Python's powerful polymorphic
list and dictionary types, for which rich syntactic support is built straight into the
language, find a use in almost every Python program. Because of the run-time typing,
Python's run time must work harder than Java's. For example, when evaluating the
expression a+b, it must first inspect the objects a and b to find out their type, which is
not known at compile time. It then invokes the appropriate addition operation, which
may be an overloaded user-defined method. Java, on the other hand, can perform an
efficient integer or floating point addition, but requires variable declarations for a and b,
and does not allow overloading of the + operator for instances of user-defined classes.

For these reasons, Python is much better suited as a "glue" language, while Java is better
characterized as a low-level implementation language. In fact, the two together make an
excellent combination. Components can be developed in Java and combined to form
applications in Python; Python can also be used to prototype components until their
design can be "hardened" in a Java implementation. To support this type of
development, a Python implementation written in Java is under development, which
allows calling Python code from Java and vice versa. In this implementation, Python
source code is translated to Java bytecode (with help from a run-time library to support
Python's dynamic semantics).

Javascript
Python's "object-based" subset is roughly equivalent to JavaScript. Like JavaScript (and
unlike Java), Python supports a programming style that uses simple functions and
variables without engaging in class definitions. However, for JavaScript, that's all there
is. Python, on the other hand, supports writing much larger programs and better code
reuse through a true object-oriented programming style, where classes and inheritance
play an important role.

Perl
Python and Perl come from a similar background (Unix scripting, which both have long
outgrown), and sport many similar features, but have a different philosophy. Perl
emphasizes support for common application-oriented tasks, e.g. by having built-in
regular expressions, file scanning and report generating features. Python emphasizes
support for common programming methodologies such as data structure design and
object-oriented programming, and encourages programmers to write readable (and thus
maintainable) code by providing an elegant but not overly cryptic notation. As a
consequence, Python comes close to Perl but rarely beats it in its original application
domain; however Python has an applicability well beyond Perl's niche.
Tcl
Like Python, Tcl is usable as an application extension language, as well as a stand-alone
programming language. However, Tcl, which traditionally stores all data as strings, is
weak on data structures, and executes typical code much slower than Python. Tcl also
lacks features needed for writing large programs, such as modular namespaces. Thus,
while a "typical" large application using Tcl usually contains Tcl extensions written in C
or C++ that are specific to that application, an equivalent Python application can often
be written in "pure Python". Of course, pure Python development is much quicker than
having to write and debug a C or C++ component. It has been said that Tcl's one
redeeming quality is the Tk toolkit. Python has adopted an interface to Tk as its standard
GUI component library.

Tcl 8.0 addresses the speed issuse by providing a bytecode compiler with limited data
type support, and adds namespaces. However, it is still a much more cumbersome
programming language.

Smalltalk
Perhaps the biggest difference between Python and Smalltalk is Python's more
"mainstream" syntax, which gives it a leg up on programmer training. Like Smalltalk,
Python has dynamic typing and binding, and everything in Python is an object.
However, Python distinguishes built-in object types from user-defined classes, and
currently doesn't allow inheritance from built-in types. Smalltalk's standard library of
collection data types is more refined, while Python's library has more facilities for
dealing with Internet and WWW realities such as email, HTML and FTP.

Python has a different philosophy regarding the development environment and


distribution of code. Where Smalltalk traditionally has a monolithic "system image"
which comprises both the environment and the user's program, Python stores both
standard modules and user modules in individual files which can easily be rearranged or
distributed outside the system. One consequence is that there is more than one option for
attaching a Graphical User Interface (GUI) to a Python program, since the GUI is not
built into the system.

C++
Almost everything said for Java also applies for C++, just more so: where Python code
is typically 3-5 times shorter than equivalent Java code, it is often 5-10 times shorter
than equivalent C++ code! Anecdotal evidence suggests that one Python programmer
can finish in two months what two C++ programmers can't complete in a year. Python
shines as a glue language, used to combine components written in C++.

Common Lisp and Scheme


These languages are close to Python in their dynamic semantics, but so different in their
approach to syntax that a comparison becomes almost a religious argument: is Lisp's
lack of syntax an advantage or a disadvantage? It should be noted that Python has
introspective capabilities similar to those of Lisp, and Python programs can construct
and execute program fragments on the fly. Usually, real-world properties are decisive:
Common Lisp is big (in every sense), and the Scheme world is fragmented between
many incompatible versions, where Python has a single, free, compact implementation

The Pandas DataFrame is a structure that contains two-dimensional data and its
corresponding labels. DataFrames are widely used in data science, machine learning,
scientific computing, and many other data-intensive fields.
DataFrames are similar to SQL tables or the spreadsheets that you work with in Excel or
Calc. In many cases, DataFrames are faster, easier to use, and more powerful than
tables or spreadsheets because they’re an integral part of
the Python and NumPy ecosystems.
In this tutorial, you’ll learn:
 What a Pandas DataFrame is and how to create one
 How to access, modify, add, sort, filter, and delete data

 How to handle missing values


 How to work with time-series data
 How to quickly visualize data

It’s time to get started with Pandas DataFrames!

Introducing the Pandas DataFrame


Pandas DataFrames are data structures that contain:
 Data organized in two dimensions, rows and columns
 Labels that correspond to the rows and columns

You can start working with DataFrames by importing Pandas:


>>>

>>> import pandas as pd


Now that you have Pandas imported, you can work with DataFrames.
Imagine you’re using Pandas to analyze data about job candidates for a position
developing web applications with Python. Say you’re interested in the candidates’
names, cities, ages, and scores on a Python programming test, or py-score:
name city age py-score

101 Xavier Mexico City 41 88.0

102 Ann Toronto 28 79.0

103 Jana Prague 33 81.0

104 Yi Shanghai 34 80.0

105 Robin Manchester 38 68.0

106 Amal Cairo 31 61.0

107 Nori Osaka 37 84.0

In this table, the first row contains the column labels (name, city, age, and py-score).
The first column holds the row labels (101, 102, and so on). All other cells are filled with
the data values.
Now you have everything you need to create a Pandas DataFrame.
There are several ways to create a Pandas DataFrame. In most cases, you’ll use
the DataFrame constructor and provide the data, labels, and other information. You can
pass the data as a two-dimensional list, tuple, or NumPy array. You can also pass it as
a dictionary or Pandas Series instance, or as one of several other data types not
covered in this tutorial.
For this example, assume you’re using a dictionary to pass the data:
>>>

>>> data = {
... 'name': ['Xavier', 'Ann', 'Jana', 'Yi', 'Robin', 'Amal', 'Nori'],
... 'city': ['Mexico City', 'Toronto', 'Prague', 'Shanghai',
... 'Manchester', 'Cairo', 'Osaka'],
... 'age': [41, 28, 33, 34, 38, 31, 37],
... 'py-score': [88.0, 79.0, 81.0, 80.0, 68.0, 61.0, 84.0]
... }

>>> row_labels = [101, 102, 103, 104, 105, 106, 107]


data is a Python variable that refers to the dictionary that holds your candidate data. It
also contains the labels of the columns:
 'name'
 'city'

 'age'
 'py-score'

Finally, row_labels refers to a list that contains the labels of the rows, which are
numbers ranging from 101 to 107.
Now you’re ready to create a Pandas DataFrame:
>>>

>>> df = pd.DataFrame(data=data, index=row_labels)


>>> df
name city age py-score
101 Xavier Mexico City 41 88.0
102 Ann Toronto 28 79.0
103 Jana Prague 33 81.0
104 Yi Shanghai 34 80.0
105 Robin Manchester 38 68.0
106 Amal Cairo 31 61.0
107 Nori Osaka 37 84.0
That’s it! df is a variable that holds the reference to your Pandas DataFrame. This
Pandas DataFrame looks just like the candidate table above and has the following
features:
 Row labels from 101 to 107
 Column labels such as 'name', 'city', 'age', and 'py-score'

 Data such as candidate names, cities, ages, and Python test scores

This figure shows the labels and data from df:


The row labels are outlined in blue, whereas the column labels are outlined in red, and
the data values are outlined in purple.
Pandas DataFrames can sometimes be very large, making it impractical to look at all the
rows at once. You can use .head() to show the first few items and .tail() to show the last
few items:
>>>

>>> df.head(n=2)
name city age py-score
101 Xavier Mexico City 41 88.0
102 Ann Toronto 28 79.0

>>> df.tail(n=2)
name city age py-score
106 Amal Cairo 31 61.0
107 Nori Osaka 37 84.0
That’s how you can show just the beginning or end of a Pandas DataFrame. The
parameter n specifies the number of rows to show.
Note: It may be helpful to think of the Pandas DataFrame as a dictionary of columns, or
Pandas Series, with many additional features.
You can access a column in a Pandas DataFrame the same way you would get a value
from a dictionary:
>>>

>>> cities = df['city']


>>> cities
101 Mexico City
102 Toronto
103 Prague
104 Shanghai
105 Manchester
106 Cairo
107 Osaka
Name: city, dtype: object
This is the most convenient way to get a column from a Pandas DataFrame.
If the name of the column is a string that is a valid Python identifier, then you can
use dot notation to access it. That is, you can access the column the same way you
would get the attribute of a class instance:
>>>

>>> df.city
101 Mexico City
102 Toronto
103 Prague
104 Shanghai
105 Manchester
106 Cairo
107 Osaka
Name: city, dtype: object
That’s how you get a particular column. You’ve extracted the column that corresponds
with the label 'city', which contains the locations of all your job candidates.
It’s important to notice that you’ve extracted both the data and the corresponding
row labels:
Each column of a Pandas DataFrame is an instance of pandas.Series, a structure that
holds one-dimensional data and their labels. You can get a single item of a Series object
the same way you would with a dictionary, by using its label as a key:
>>>

>>> cities[102]
'Toronto'
In this case, 'Toronto' is the data value and 102 is the corresponding label. As you’ll see
in a later section, there are other ways to get a particular item in a Pandas DataFrame.
You can also access a whole row with the accessor .loc[]:
>>>

>>> df.loc[103]
name Jana
city Prague
age 33
py-score 81
Name: 103, dtype: object

This time, you’ve extracted the row that corresponds to the label 103, which contains
the data for the candidate named Jana. In addition to the data values from this row,
you’ve extracted the labels of the corresponding columns:

The returned row is also an instance of pandas.Series.


Creating a Pandas DataFrame
As already mentioned, there are several way to create a Pandas DataFrame. In this
section, you’ll learn to do this using the DataFrame constructor along with:
 Python dictionaries
 Python lists

 Two-dimensional NumPy arrays


 Files

There are other methods as well, which you can learn about in the official
documentation.
You can start by importing Pandas along with NumPy, which you’ll use throughout the
following examples:

>>>

>>> import numpy as np


>>> import pandas as pd
That’s it. Now you’re ready to create some DataFrames.
Creating a Pandas DataFrame With Dictionaries
As you’ve already seen, you can create a Pandas DataFrame with a Python dictionary:
>>>

>>> d = {'x': [1, 2, 3], 'y': np.array([2, 4, 8]), 'z': 100}

>>> pd.DataFrame(d)
x y z
0 1 2 100
1 2 4 100
2 3 8 100
The keys of the dictionary are the DataFrame’s column labels, and the dictionary
values are the data values in the corresponding DataFrame columns. The values can be
contained in a tuple, list, one-dimensional NumPy array, Pandas Series object, or one of
several other data types. You can also provide a single value that will be copied along
the entire column.
It’s possible to control the order of the columns with the columns parameter and the
row labels with index:
>>>
>>> pd.DataFrame(d, index=[100, 200, 300], columns=['z', 'y', 'x'])
z y x
100 100 2 1
200 100 4 2
300 100 8 3
As you can see, you’ve specified the row labels 100, 200, and 300. You’ve also forced
the order of columns: z, y, x.
Creating a Pandas DataFrame With Lists
Another way to create a Pandas DataFrame is to use a list of dictionaries:
>>>

>>> l = [{'x': 1, 'y': 2, 'z': 100},


... {'x': 2, 'y': 4, 'z': 100},
... {'x': 3, 'y': 8, 'z': 100}]

>>> pd.DataFrame(l)
x y z
0 1 2 100
1 2 4 100
2 3 8 100
Again, the dictionary keys are the column labels, and the dictionary values are the data
values in the DataFrame.
You can also use a nested list, or a list of lists, as the data values. If you do, then it’s
wise to explicitly specify the labels of columns, rows, or both when you create the
DataFrame:
>>>

>>> l = [[1, 2, 100],


... [2, 4, 100],
... [3, 8, 100]]

>>> pd.DataFrame(l, columns=['x', 'y', 'z'])


x y z
0 1 2 100
1 2 4 100
2 3 8 100
That’s how you can use a nested list to create a Pandas DataFrame. You can also use a
list of tuples in the same way. To do so, just replace the nested lists in the example
above with tuples.
Creating a Pandas DataFrame With NumPy Arrays
You can pass a two-dimensional NumPy array to the DataFrame constructor the same
way you do with a list:
>>>

>>> arr = np.array([[1, 2, 100],


... [2, 4, 100],
... [3, 8, 100]])

>>> df_ = pd.DataFrame(arr, columns=['x', 'y', 'z'])


>>> df_
x y z
0 1 2 100
1 2 4 100
2 3 8 100
Although this example looks almost the same as the nested list implementation above,
it has one advantage: You can specify the optional parameter copy.
When copy is set to False (its default setting), the data from the NumPy array isn’t
copied. This means that the original data from the array is assigned to the Pandas
DataFrame. If you modify the array, then your DataFrame will change too:
>>>

>>> arr[0, 0] = 1000

>>> df_
x y z
0 1000 2 100
1 2 4 100
2 3 8 100
As you can see, when you change the first item of arr, you also modify df_.
Note: Not copying data values can save you a significant amount of time and processing
power when working with large datasets.
If this behavior isn’t what you want, then you should specify copy=True in
the DataFrame constructor. That way, df_ will be created with a copy of the values
from arr instead of the actual values.
Creating a Pandas DataFrame From Files
You can save and load the data and labels from a Pandas DataFrame to and from a
number of file types, including CSV, Excel, SQL, JSON, and more. This is a very powerful
feature.
You can save your job candidate DataFrame to a CSV file with .to_csv():
>>>

>>> df.to_csv('data.csv')
The statement above will produce a CSV file called data.csv in your working directory:
,name,city,age,py-score
101,Xavier,Mexico City,41,88.0
102,Ann,Toronto,28,79.0
103,Jana,Prague,33,81.0
104,Yi,Shanghai,34,80.0
105,Robin,Manchester,38,68.0
106,Amal,Cairo,31,61.0
107,Nori,Osaka,37,84.0
Now that you have a CSV file with data, you can load it with read_csv():
>>>

>>> pd.read_csv('data.csv', index_col=0)


name city age py-score
101 Xavier Mexico City 41 88.0
102 Ann Toronto 28 79.0
103 Jana Prague 33 81.0
104 Yi Shanghai 34 80.0
105 Robin Manchester 38 68.0
106 Amal Cairo 31 61.0
107 Nori Osaka 37 84.0
That’s how you get a Pandas DataFrame from a file. In this case, index_col=0 specifies
that the row labels are located in the first column of the CSV file.

Retrieving Labels and Data


Now that you’ve created your DataFrame, you can start retrieving information from it.
With Pandas, you can perform the following actions:
 Retrieve and modify row and column labels as sequences
 Represent data as NumPy arrays
 Check and adjust the data types
 Analyze the size of DataFrame objects

Pandas DataFrame Labels as Sequences


You can get the DataFrame’s row labels with .index and its column labels
with .columns:
>>>

>>> df.index
Int64Index([1, 2, 3, 4, 5, 6, 7], dtype='int64')

>>> df.columns
Index(['name', 'city', 'age', 'py-score'], dtype='object')
Now you have the row and column labels as special kinds of sequences. As you can with
any other Python sequence, you can get a single item:
>>>

>>> df.columns[1]
'city'
In addition to extracting a particular item, you can apply other sequence operations,
including iterating through the labels of rows or columns. However, this is rarely
necessary since Pandas offers other ways to iterate over DataFrames, which you’ll see
in a later section.
You can also use this approach to modify the labels:
>>>

>>> df.index = np.arange(10, 17)

>>> df.index
Int64Index([10, 11, 12, 13, 14, 15, 16], dtype='int64')

>>> df
name city age py-score
10 Xavier Mexico City 41 88.0
11 Ann Toronto 28 79.0
12 Jana Prague 33 81.0
13 Yi Shanghai 34 80.0
14 Robin Manchester 38 68.0
15 Amal Cairo 31 61.0
16 Nori Osaka 37 84.0
In this example, you use numpy.arange() to generate a new sequence of row labels that
holds the integers from 10 to 16. To learn more about arange(), check out NumPy
arange(): How to Use np.arange().
Keep in mind that if you try to modify a particular item of .index or .columns, then
you’ll get a TypeError.
Reading and Writing CSV Files in Python
 Last Updated : 22 Jun, 2020
CSV (Comma Separated Values) format is the most common import and export
format for spreadsheets and databases. It is one of the most common methods for
exchanging data between applications and popular data format used in Data Science. It
is supported by a wide range of applications. A CSV file stores tabular data in which
each data field is separated by a delimiter(comma in most cases). To represent a CSV
file, it must be saved with the .csv file extension.
Reading from CSV file
Python contains a module called csv for the handling of CSV files. The reader class
from the module is used for reading data from a CSV file. At first, the CSV file is
opened using the open() method in ‘r’ mode(specifies read mode while opening a file)
which returns the file object then it is read by using the reader() method of CSV module
that returns the reader object that iterates throughout the lines in the specified CSV
document.
Syntax:
csv.reader(csvfile, dialect='excel', **fmtparams
Note: The ‘with‘ keyword is used along with the open() method as it simplifies
exception handling and automatically closes the CSV file.
Example:

Consider the below CSV file –

filter_none
brightness_4

import csv

# opening the CSV file

with open('Giants.csv', mode ='r')as file:

# reading the CSV file

csvFile = csv.reader(file)

# displaying the contents of the CSV file

for lines in csvFile:

print(lines)

Output:
[['Steve', 13, 'A'],
['John', 14, 'F'],
['Nancy', 14, 'C'],
['Ravi', 13, 'B']]
Writing to CSV file

csv.writer class is used to insert data to the CSV file. This class returns a writer object
which is responsible for converting the user’s data into a delimited string. A CSV file
object should be opened with newline=” otherwise, newline characters inside the
quoted fields will not be interpreted correctly.
Syntax:
csv.writer(csvfile, dialect='excel', **fmtparams)
csv.writer class provides two methods for writing to CSV. They
are writerow() and writerows().
 writerow(): This method writes a single row at a time. Field row can be written us-
ing this method.
Syntax:
writerow(fields)
 writerows(): This method is used to write multiple rows at a time. This can be used
to write rows list.
Syntax:

writerows(rows)
Example:
filter_none
brightness_4

# Python program to demonstrate

# writing to CSV

import csv

# field names

fields = ['Name', 'Branch', 'Year', 'CGPA']

# data rows of csv file

rows = [ ['Nikhil', 'COE', '2', '9.0'],

['Sanchit', 'COE', '2', '9.1'],


['Aditya', 'IT', '2', '9.3'],

['Sagar', 'SE', '1', '9.5'],

['Prateek', 'MCE', '3', '7.8'],

['Sahil', 'EP', '2', '9.1']]

# name of csv file

filename = "university_records.csv"

# writing to csv file

with open(filename, 'w') as csvfile:

# creating a csv writer object

csvwriter = csv.writer(csvfile)

# writing the fields

csvwriter.writerow(fields)

# writing the data rows

csvwriter.writerows(rows)

Output:
We can also write dictionary to the CSV file. For this the CSV module provides the
csv.DictWriter class. This class returns a writer object which maps dictionaries onto
output rows.
Syntax:
csv.DictWriter(csvfile, fieldnames, restval=”, extrasaction=’raise’, dialect=’excel’,
*args, **kwds)
csv.DictWriter provides two methods for writing to CSV. They are:
 writeheader(): writeheader() method simply writes the first row of your csv file us-
ing the pre-specified fieldnames.
Syntax:
writeheader()
 writerows(): writerows method simply writes all the rows but in each row, it writes
only the values(not keys).
Syntax:
writerows(mydict)
Example:
filter_none
brightness_4

# importing the csv module

import csv

# my data rows as dictionary objects


mydict =[{'branch': 'COE', 'cgpa': '9.0', 'name': 'Nikhil', 'year': '2'},

{'branch': 'COE', 'cgpa': '9.1', 'name': 'Sanchit', 'year': '2'},

{'branch': 'IT', 'cgpa': '9.3', 'name': 'Aditya', 'year': '2'},

{'branch': 'SE', 'cgpa': '9.5', 'name': 'Sagar', 'year': '1'},

{'branch': 'MCE', 'cgpa': '7.8', 'name': 'Prateek', 'year': '3'},

{'branch': 'EP', 'cgpa': '9.1', 'name': 'Sahil', 'year': '2'}]

# field names

fields = ['name', 'branch', 'year', 'cgpa']

# name of csv file

filename = "university_records.csv"

# writing to csv file

with open(filename, 'w') as csvfile:

# creating a csv dict writer object

writer = csv.DictWriter(csvfile, fieldnames = fields)

# writing headers (field names)


writer.writeheader()

# writing data rows

writer.writerows(mydict)

Output:

SQL-STRUCTURED QUERY LANGUAGE

SQL is not a procedural language. It is not used to define complex processes; we can
use SQL to use commands that define and manipulate data. SQL is different from other
languages.
• SQL is very readable.
• In SQL we always issue commands.
SQL statements fall into two groups:-
● Data Definition Language (DDL) – DDL statements are used to describe the tables and
the data they contain. The subset of SQL statements used for modeling the structure
(rather than the contents) of a database or cube. The DDL gives you the ability to
create, modify, and remove databases and database objects.
● Data Manipulation Language (DML) – DML statements that are used to operate on
data in the database. These are statements that allow you to create or alter objects
(such as tables, indexes, views, and so on) in the database. The subset of SQL
statements used to retrieve and manipulate data. DML can be further divided into 2
groups:-
● Select Statements – Statements that return a set of results.
Everything else – Statements that don’t return a set of results.
Here are some of the quires defined:-

SELECT - SQL statement used to request a selection, projection, join, query, and so on,
from a SQL Server database.
Primary key – Primary key constraints identify the column or set of columns whose
values uniquely identify a row in a table. No two rows in a table can have the same
primary key value. You cannot enter a NULL value for any column in a primary key.
Insert- The Insert logical operator inserts each row from its input into the object
specified in the Argument column. To insert the data into a relation we either specify a
tuple to be inserted or write a query.
Delete- The Delete logical operator deletes from an object rows that satisfy the
optional predicate in the Argument column. We can delete only whole tuples; we
cannot delete values on only particular attributes.
Update- The Update logical operator updates each row from its input in the object
specified in the Argument column. It provides a way of modifying existing data in a
table.
Preliminary
Design
Database
Design
implementation
code
BIBILOGRAPHY

Book: INFORMATICS PRACTICES

Writtten by:

1. Sumita Arora 12th IP

2. Oxford 12th IP

You might also like