StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

The source Code for the implementation of Python - Coursework Example

Cite this document
Summary
This research evaluates and presents Python, the program that was implemented by importing each of the three CSV data files into the SQLite database and then manipulating them in python by use of SQL commands. …
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER91.3% of users find it useful
The source Code for the implementation of Python
Read Text Preview

Extract of sample "The source Code for the implementation of Python"

work, Logic and Programming Software Development – Python Implementation The program was implemented by importing each ofthe three CSV data files into the SQLite database and then manipulating them in python by use of SQL commands. The source Code for the implementation is presented below: 1.1. Using data File 3333658a.csv 1.1.1. Source Code: import sqlite3 connection = sqlite3.connect("data2.db") cursor = connection.cursor() cursor.execute ("SELECT avg (channels) as Avchannel FROM table2") print ("Averages Channel:") result = cursor.fetchall() for r in result: print (r) cursor.execute ("SELECT count (invest) FROM table2") print ("\nCount of Nows:") res = cursor.fetchall() print (res) cursor.execute ("select ((SELECT COUNT(age) FROM table2 WHERE age between 24 and 35) *100 / (SELECT COUNT(age) FROM table2)) as perc FROM table2") print ("\nPercentage of age 24 to 35:") res = cursor.fetchall() print (res2) cursor.execute ("select count (*) from table2 where code not like %xx9x%") print ("\nRecord in the Format") res = cursor.fetchall() print (res3) cursor.execute ("select distinct substr(stock,2,3) as CommonString, count (*) as NumberOfTimes from table2 group by 1") print ("\n Counting the Common Strings") res = cursor.fetchall() print (res4) cursor.execute ("select ((SELECT COUNT(area) FROM table2 WHERE area = 793.59 or area> 793.59) *100 / (SELECT COUNT(area) FROM table2)) as PercentageArea FROM table2") print ("\n Percentage of Area = 793.59:") res = cursor.fetchall() print (res5) cursor.execute ("SELECT COUNT(*) FROM table2 WHERE area > 1609.62 or stock= consider") print ("\Count of Area and Stock:") res = cursor.fetchall() print (res6) 1.1.2. Output Figure 1: Averages Channel Figure 2: Count of Nows Figure 3: Percentage of age 24 to 35 Figure 4: Record in the Format Figure 5: Counting the Common Strings Figure 6: Percentage of Area = 793.59 Figure 7: Count of Area and Stock 1.2. Using data File 3333658b.csv: 1.2.1. Source Code import sqlite3 connection = sqlite3.connect("data2.db") cursor = connection.cursor() cursor.execute ("SELECT avg (channels) as Avchannel FROM table3") print ("Averages Channel:") result = cursor.fetchall() for r in result: print (r) cursor.execute ("SELECT count (invest) FROM table3") print ("\nCount of Nows:") res = cursor.fetchall() print (res) cursor.execute ("select ((SELECT COUNT(age) FROM table3 WHERE age between 24 and 35) *100 / (SELECT COUNT(age) FROM table3)) as perc FROM table3") print ("\nPercentage of age 24 to 35:") res = cursor.fetchall() print (res2) cursor.execute ("select count (*) from table3 where code not like %xx9x%") print ("\nRecord in the Format") res = cursor.fetchall() print (res3) cursor.execute ("select distinct substr(stock,2,3) as CommonString, count (*) as NumberOfTimes from table3 group by 1") print ("\n Counting the Common Strings ") res = cursor.fetchall() print (res4) cursor.execute ("select ((SELECT COUNT(area) FROM table3 WHERE area = 793.59 or area> 793.59) *100 / (SELECT COUNT(area) FROM table3)) as PercentageArea FROM table3") print ("\n Percentage of Area = 793.59:") res = cursor.fetchall() print (res5) cursor.execute ("SELECT COUNT(*) FROM table3 WHERE area > 1609.62 or stock= consider") print ("\n Count of Area and Stock:”) res = cursor.fetchall() print (res6) 1.2.2. Output Figure 8: Averages Channel Figure 9: Count of Nows Figure 10: Percentage of age 24 to 35 Figure 11: Record in the Format Figure 12: Counting the Common Strings Figure 13: Percentage of Area = 793.59 Figure 14: Count of Area and Stock 1.3. Using data File 3333658c.csv 1.3.1. Source Code import sqlite3 connection = sqlite3.connect("data2.db") cursor = connection.cursor() cursor.execute ("SELECT avg (channels) as Avchannel FROM table4") print ("Averages Channel:") result = cursor.fetchall() for r in result: print (r) cursor.execute ("SELECT count (invest) FROM table4") print ("\n Count of Nows:") res = cursor.fetchall() print (res) cursor.execute ("select ((SELECT COUNT(age) FROM table4 WHERE age between 24 and 35) *100 / (SELECT COUNT(age) FROM table4)) as perc FROM table4") print ("\n Percentage of age 24 to 35:") res = cursor.fetchall() print (res2) cursor.execute ("select count (*) from table4 where code not like %xx9x%") print ("\n Record in the Format") res = cursor.fetchall() print (res3) cursor.execute ("select distinct substr(stock,2,3) as CommonString, count (*) as NumberOfTimes from table4 group by 1") print ("\n Counting the Common Strings ") res = cursor.fetchall() print (res4) cursor.execute ("select ((SELECT COUNT(area) FROM table4 WHERE area = 793.59 or area> 793.59) *100 / (SELECT COUNT(area) FROM table4)) as PercentageArea FROM table4") print ("\nPercentage of Area = 793.59:") res = cursor.fetchall() print (res5) cursor.execute ("SELECT COUNT(*) FROM table4 WHERE area > 1609.62 or stock= consider") print ("\n Count of Area and Stock:") res = cursor.fetchall() print (res6) 1.3.2. Output Figure 15: Averages Channel Figure 16: Count of Now’s Figure 17: Percentage of age 24 to 35 Figure 18: Record in the Format Figure 19: Counting the Common Strings Figure 20: Percentage of Area = 793.59 Figure 21: Count of Area and Stock 2. Report 2.1. Summary The program was successful as it executed in the Python GUI option. The application of the dynamic entry of the data set was however not successful, prompting the data to be imported in SQLLite database. Each of the datasets was imported as a table in the database. For example: 3333658a.csv was imported as table2 3333658b.csv was imported as table3 3333658c.csv was imported as table4 All the fields were retained in the datasets. For each of the data files, the program performed multiple query execution. There were 7 questions, each with a separate SQL command to be executed in the program. The outcome is that the output is also displayed as a continuous block at the end of each source code. 2.2. Areas of Modification Essentially, because the questions applied to all the datasets, all the sections of the source code remained the same except the name of the table, which varied in all the source codes, from table2, to table3 then to table4. With this, the results were obtained differently. The second area of modification involved introduction of advanced methods in the management of the data files. This involved the introduction of GUI interactive platform to replace the commandlines. For example, the user is prompted by the system to enter the file name as shown below: filename = input("Enter file name (name.csv):") try: file = open(filename, "r") The user is then prompted to enter the name of the data file as shown below: 2.3. Evidence of Program Working The program worked as per the requirement. This is confirmed by the screenshots captured during the execution of the program. The screenshots contain accurate values for the answers to the 7 questions in each stage. In that regard, the program is not only running, but also it is answering all the 7 questions in various ways. 2.3.1. Summary The program was executed in python 2.7.6. The challenge faced in its development process was to eliminate numerous errors. Various syntax and runtime errors were faced in the preparation of the program. The second challenge was the integration between python program and SQLite program. 3. Evaluation In this project, I have been able to develop the program to perform the analysis of the data in the csv data files. The future of this program focuses on the ways of increasing the use of graphical tools and objects to further simplify the entire process. The level of success in this project can be given an overall rating of 77%. Once the transformation is done and the system becomes a full GUI application, then the rating can be increased beyond the current 77%. 4. Reflection of Experience 4.1. Good Experience The good experiences which a student ought to avoid in programming include sensitivity to cases while writing the SQL commands or the python code. It is good for a student to use the right cases and realize that in programming, some programming tools are case sensitive. Secondly, the student ought to develop the habit of writing comments as part of the software documentation. 4.2. Bad Practices One of the bad practices to be avoided by the student is wrong syntax in programming. The student must present the codes according to the rules of the programming language. Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(“The source Code for the implementation of Python Coursework”, n.d.)
Retrieved from https://studentshare.org/logic-programming/1699926-software-development-python-please-see-attachment
(The Source Code for the Implementation of Python Coursework)
https://studentshare.org/logic-programming/1699926-software-development-python-please-see-attachment.
“The Source Code for the Implementation of Python Coursework”, n.d. https://studentshare.org/logic-programming/1699926-software-development-python-please-see-attachment.
  • Cited: 0 times

CHECK THESE SAMPLES OF The source Code for the implementation of Python

Python for S60 Platform

The major advantage of python use in mobile phone platforms is its ability to ensure powerful Augmented Reality (AR) applications.... However, the use of python as the main language has proved to make the process much easier.... The paper "python for S60 Platform" proved PyS60 is one of the most versatile and useful platforms for developers to base their apps.... hellip; python is one of the simple programming languages with a rich library of tools and functionalities to support programming....
7 Pages (1750 words) Case Study

Master Dissertation Proposal

However they all share some same (Jablonski, 1991) This dissertation proposal is about implementation of a TQM structure through information technology.... (Batt and Moynihan, 2002) A lot of research has been carried out on implementation of TQM in the service industry, however little emphasis has been on use of IT in implementation of TQM.... Research has confirmed that implementation of TQM and effective use of IT is far from execution in the service delivery sector....
4 Pages (1000 words) Essay

Cassandra Database

The new version has performance improvements based on the improved row cache, faster reads and writes, reduced heap, and new counters implementation.... After Facebook decided to open source the code, Cassandra became an incubator for Apache… Cassandra database is an open-source system designed to store and manages large quantities of data across the entire commodity servers.... Cassandra Database is a wide spread open source NoSQL database....
8 Pages (2000 words) Case Study

SQL Injection Vulnerabilities

Exploiting SQL injection vulnerabilities enables an attacker to persistently foist dynamic and storage page content generation that would include malicious code in the attacked site.... The aim of the paper "SQL Injection Vulnerabilities" is to provide comprehensive guidance on the use of the open source techniques and tools for independent identification of common SQL injection vulnerabilities simulating the attacker's approaches....
5 Pages (1250 words) Research Paper

Product Differentiation and Cost Reduction as Booster of Companys Sale

A primary source is a data obtained by the first-hand interview, observation, filling with questionnaires among other many sources.... Secondary source, on the other hand, is the data that is originally collected and published by another researcher for other purposes.... Observation, carried out on a traffic jam, which can involve manual counting of the cars, is a source of data....
3 Pages (750 words) Dissertation

Apache Web Server vs IIS 6

nbsp;This paper has offered a detailed overview of both technologies and their implementation areas.... encompasses a new implementation and execution model, improved management services, as well as considerably augmented performance (Secunia ApS) & (Thangarathinam) & (Whitrow).... The fresh release included a brand-new execution and implementation environment that divided the fundamental functionality of the Apache web-based system in fact processed and supported requests....
5 Pages (1250 words) Coursework

Cassandra Database

This review ''Cassandra Database'' tells about the open source system designed to store and manages large quantities of data across the entire commodity servers.... Consequently, the paper will further discuss the database based on its data storage, query format, and its query processingCassandra Database is a wide spread open source NoSQL database....
8 Pages (2000 words) Literature review

My Role as a Student and a Person in the Critical Incident

"My Role as a Student and a Person in the Critical Incident" paper examines the incident that is generally about producing a report from an existing research proposal that contains different important issues on community safety.... It requires a deep understanding of research methods and processes....
9 Pages (2250 words) Essay
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us