Programming with Data Lab 7

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

Lecture Microsoft Access and Relational Database Basics.
Computers They're Not Magic! (for the most part)‏ Adapted from Ryan Moore.
Simple Web SQLite Manager/Form/Report
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
Miscellaneous Excel Combining Excel and Access. – Importing, exporting and linking Parsing and manipulating data. 1.
Concepts of Database Management, Fifth Edition Chapter 1: Introduction to Database Management.
M1G Introduction to Database Development 6. Building Applications.
File Processing Concepts – Field – combination of 1 or more characters that is the smallest unit of data to be accessed – Record – group of related fields.
Dr Gordon Russell, Napier University Unit Embedded SQL - V3.0 1 Embedded SQL Unit 5.1.
Concept Mapping concepts and exercises K. Yue. Why Learning is difficult? When we learn a new ‘thing’? There are many concepts: 10s to 1000s, depending.
Chapter 5 Database Processing. Neil uses software to query a database, but it has about 25 standard queries that don’t give him all he needs. He imports.
CERN - IT Department CH-1211 Genève 23 Switzerland t DB Development Tools Benthic SQL Developer Application Express WLCG Service Reliability.
ITGS Databases.
McGraw-Hill/Irwin The O’Leary Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Access 2002 Lab 3 Analyzing Tables and Creating.
1 CS 430 Database Theory Winter 2005 Lecture 14: Additional SQL Topics.
BOĞAZİÇİ UNIVERSITY DEPARTMENT OF MANAGEMENT INFORMATION SYSTEMS MATLAB AS A DATA MINING ENVIRONMENT.
Dr Gordon Russell, Napier University Unit Embedde SQL - V2.0 1 Embedded SQL Unit 5.1.
A Guide to SQL, Eighth Edition Chapter Eight SQL Functions and Procedures.
Invitation to Computer Science 6 th Edition Chapter 10 The Tower of Babel.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Introduction to Database Programming with Python Gary Stewart
Developing Visual Basic Applications to Interact with an Access Database Training Session Brian R. Kovar Kansas State University 8 th AIS Educator Annual.
INTRODUCTION TO DATABASES (MICROSOFT ACCESS)
Relational Databases: Basic Concepts
CST 1101 Problem Solving Using Computers
Fusion Tables.
Concept Mapping concepts and exercises
Introduction to Database Systems, CS420
Miscellaneous Excel Combining Excel and Access.
A Guide to SQL, Seventh Edition
Databases and Database Management Systems Chapter 9
Principles of Software Development
Looking at your data in a New Way
Databases.
RELATIONAL DATABASE MODEL
Tutorial 8 Objectives Continue presenting methods to import data into Access, export data from Access, link applications with data stored in Access, and.
Exam Braindumps
Databases and Information Management
MS Access Database Connection
Teaching Computing to GCSE
CPSC-310 Database Systems
Network Visualization
Structured Query Language (SQL) William Klingelsmith
System And Application Software
Chapter 2 Database Environment.
MANAGING DATA RESOURCES
SQL Standard Query Language Good for manipulating a Database
What is Database? A database is a collection of data with defined structure and purpose. Data can easily be accessed, managed, and updated. Data can be.
Python I/O.
Database.
Introduction to Customizing Reports in SAP
What Are Databases? Organized by Dr. Farrokh Alemi PhD
Unit# 6: ICT Applications
Databases and Information Management
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
Chapter 10 ADO.
Convert (flatten) IATI XML file to CSV file(s) using XQUERY
Chapter 8 Advanced SQL.
DATABASES WHAT IS A DATABASE?
Do it now – PAGE 3 You will find your do it now task in your workbook – look for the start button! Tuesday, 09 April 2019.
Relational Databases: Basic Concepts
Relational Databases: Basic Concepts
Python Basics with Jupyter Notebook
Databases Continued 10/18/05.
Programming with data Lab 9
Database SQL.
SQL – Application Persistence Design Patterns
Tutorial 10 Automating Tasks with Macros
Presentation transcript:

Programming with Data Lab 7 Tuesday, 4 Dec. 2018 Stelios Sotiriadis Prof. Alessandro Provetti

What we will learn today? Recap on gradient descent SQLite Pandas

Lets review the code and run it together: Class6-grad_descent(mx+b).py Gradient descent Lets review the code and run it together: Class6-grad_descent(mx+b).py

Portable relational DBMS The SQLite 3 Module Portable relational DBMS

Important data is … Shared (centralized) Frequently updated but long-term relevant Mostly (80%, according to recent reviews) sitting inside RDBMS Data management needs a proper, application-independent design Entity-Relationship (ER) and Unified Modelling Language (UML) are visual language for defining the structure of data

Relational DBMSs isolate you from the data: so you don’t spoil it maximise I/O performance (optimization inside) take care of multiple access and authorization take care of back-up and durability (w. HW) provide a uniform interface: the SQL syntax you need a monster software on a monster computer

SQLite language-specific drivers support SQL embedding data sits in a local file ideal for local testing ideal for presenting data in an easily accessible standard format

Examples Examples of SQLite Lets run it! Class7-sqlite-queries.py import sqlite3 # Create a connector and a database called mydb conn = sqlite3.connect('mydb') # create a cursor (a way to run SQL queries) cursor = conn.cursor() # example of an SQL statement (assuming there is a table…) cursor.execute('''SELECT * FROM users''') # fetch results and save it in all_rows all_rows = cursor.fetchall() # access rows using a for loop (row[0] first column data) for row in all_rows: print(row[0], row[1], …) Lets run it! Class7-sqlite-queries.py

Pandas Modules

Basic idea Relational DBs might be seen as the computer version of paper ledgers and registries Spreadsheet might be seen as a computer version of a balance sheet a proper naming mechanism: A1, A2, B2… they greatly extended balance sheets. Now they contain lots of data. a whole-new class of what if? queries becomes available however…

Python and spreadsheets… try to replicate the positional organization of spreadsheets into python iterables support for data alignment other features my_dict = {'A': [1, 2], 'B': ['John', 4]} my_data_frame = pd.DataFrame(data=my_dict) print my_data_frame A B 0 1 3 1 John 4

The Data frames! Endows data with the tabular structure Often created by importing data, e.g. from a CSV file Handles columns well, type inference…

Pandas the DataFrame type has about 203 methods, e.g. the read_csv method has about 54 parameters hardly a need to develop ad hoc functions for our import tasks Try the Pandas cookbook 

Jupyter notebook The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. In command prompt run: Jupyter notebook Then: Upload: Class7-pandas-tutorial-1.ipynb Class7-pandas-tutorial-2.ipynb Class7-pandas-tutorial-3.ipynb Uses three datasets: https://www.dcs.bbk.ac.uk/~stelios/pwd2018/datasets/Class7-gold_prices.csv https://www.dcs.bbk.ac.uk/~stelios/pwd2018/datasets/Class7-oil_prices.csv https://www.dcs.bbk.ac.uk/~stelios/pwd2018/datasets/Class7-gas_prices.csv

Lets run it! Lets use Jupyter notebooks! How to work with data in Pandas: Run: Class7-pandas-tutorial-1.ipynb How to clean data using Pandas: Run: Class7-pandas-tutorial-2.ipynb Combine different csv files for visualizations: Run: Class7-pandas-tutorial-3.ipynb