CSV files Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.

Slides:



Advertisements
Similar presentations
DATA ANALYTICS. NORMS Cell Phones on Vibrate Respect all opinions.
Advertisements

Importing GPS Data Lecture 13. EasyGPS  Free software for downloading waypoints  EasyGPS ( EasyGPS  Free software for downloading.
Introduction to Engineering MATLAB – 11 Plotting - 4 Agenda Multiple curves Multiple plot.
MEPO Training MEPO Database Access Training Presentation Copyright 2011 Rodger B. Fluke, MPA.
By Mary Anne Poatsy, Keith Mulbery, Eric Cameron, Jason Davidson, Rebecca Lawson, Linda Lau, Jerri Williams Chapter 8 Get Connected 1 Copyright © 2014.
Designing a Database Unleashing the Power of Relational Database Design.
Python plotting for lab folk Only the stuff you need to know to make publishable figures of your data. For all else: ask Sourish.
Add a File with X, Y coordinates to MapWindow
Pasewark & Pasewark 1 Access Lesson 6 Integrating Access Microsoft Office 2007: Introductory.
1 Access Lesson 6 Integrating Access Microsoft Office 2010 Introductory Pasewark & Pasewark.
PYTHON PLOTTING CURVES CHAPTER 10_5 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
© Cheltenham Computer Training 2002 Microsoft Publisher 2002 – Slide No 1 Microsoft Publisher 2002 Intermediate Level Course.
Coding for Excel Analysis Optional Exercise Map Your Hazards! Module, Unit 2 Map Your Hazards! Combining Natural Hazards with Societal Issues.
© Paradigm Publishing, Inc. 5-1 Chapter 5 Application Software Chapter 5 Application Software.
Introduction to SPSS Edward A. Greenberg, PhD
Creating a Web Site to Gather Data and Conduct Research.
CIS 103 — Applied Computer Technology Last Edited: September 17, 2010 by C.Herbert Using Database Management Systems.
GCSE Information and Communications Technology. Assessment The course is split into 60% coursework and 40% exam You will produce coursework in year 10.
Files and Dictionaries CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
Open Your Mind to Open Source MPDO’s & EOPR’s Centre for IT & eGovernance AMR-APARD Hyderabad Welcome!
IB FieldBook User Guide Graham McLaren May Introduction The Workbench opens with an assumed active 'breeding project' and an empty list of 'studies'
© Paradigm Publishing Inc. 5-1 Chapter 5 Application Software.
MySQL Importing and creating a database. CSV (Comma Separated Values) file CSV = Comma Separated Values – they are simple text files containing data which.
® IBM Software Group © 2006 IBM Corporation JSF Panel – Section Controls This Learning Module shows how to develop server-side EGL applications with dynamic.
Files Tutor: You will need ….
Welcome CSV Imports Elizabeth Osika Associate Professor and Campus Administrator
CSV Files Intro to Computer Science CS1510 Dr. Sarah Diesburg.
How to Write a Scientific Journal Article: 101
Introduction to OBIEE:
Creates the file on disk and opens it for writing
>> Introduction to CSS
Required Data Files Review
Department of Computer Science,
Prepare data for importing
European Computer Driving Licence
Unit 4: Using Spreadsheets to Make Economic Choices Lessons 20–26
Searching and Navigating in Coeus
Preliminaries: -- vector, raster, shapefiles, feature classes.
Data Migration to DOORS DNG Presented By Adam Hammett
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Python I/O.
Bryan Burlingame Halloween 2018
DMIS Tools Course Lesson 13 - Generating DMIS Reports
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Creates the file on disk and opens it for writing
Decision Structures and Indefinite Loops
Introduction to Dictionaries
Programming Assignment #5
Homework #5 — Monte Carlo Simulation
Elements of a Python Program
More About Functions Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Variables, Lists, and Objects
Navya Thum January 30, 2013 Day 5: MICROSOFT EXCEL Navya Thum January 30, 2013.
Debuggers and Debugging
Simple Graphics Package
Objects (again) Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
More elements of Python programs
Notes on pyplot Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction.
Notes about Homework #4 Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
CSCI N317 Computation for Scientific Applications Unit R
Note on Program Design Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
Notes on Homework #6 Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
Creating and Managing Database Tables
Strings, Lists, and Files
CSV Files and ETL The Good, Bad, and Ugly
Exploring Microsoft® Office 2016 Series Editor Mary Anne Poatsy
Numpy, pylab, matplotlib (follow-up)
Nate Brunelle Today: Web Reading
Introduction to Computer Science
The Data of Visualization
Presentation transcript:

CSV files Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An Introduction to Computer Science, 2nd edition, by John Zelle and copyright notes by Prof. George Heineman of Worcester Polytechnic Institute) CS-1004, A-Term 2014 CSV files

Introduction to CSV files “CSV” — Comma Separated Values Common format for interchange among spreadsheets One “Header” row Many “rows” of data Each row is called a “record” Record:– String containing “fields” separated by commas Each field is a substring of text “Meanings” of fields Defined by Header Row CS-1004, A-Term 2014 CSV files

Example Header Row:– Data (subsequent rows) LastName,FirstName,Initial,Course,Time Data (subsequent rows) Lauer,Hugh,C,CS-1004,0800 Wills,Craig,E,CS-3013,1200 Hamel,Glynis,M,CS-1101,1000 Rich,Charles,,CS-1102,1000 Easily import to / exported from spreadsheet Each “row” of csv-file is row of spreadsheet Commas delineate columns Header row indicates meanings of columns CS-1004, A-Term 2014 CSV files

Processing CSV files in Python Module “csv” Methods csv.reader() — returns a “reader” object csv.writer() — returns a “writer” object csv.DictReader() — returns a “reader” object that makes each row a mini dictionary csv.DictWriter() — returns a “writer” object that constructs output from mini dictionary … Other methods Limit field sizes Manage “dialects” of csv files “Sniff” out the format of a csv file CS-1004, A-Term 2014 CSV files

CSV Reader Acts somewhat like file.read() for row in reader: #process row list.append(row) Format of each row:– List of strings Each element of list represents one field Empty fields from csv file  null strings in list Numbers not by default interpreted! Settable option Example smallDataSet.csv CS-1004, A-Term 2014 CSV files

CSV DictReader Each row is actually a mini-dictionary Key names taken from header row By default! Controllable Key names of all rows are same Enables access to fields by name Without having to count fields in rows Combining multiple data sets with different formats E.g., two data sets may both have 'latitude' and 'longitude' fields but differ in all other respects CS-1004, A-Term 2014 CSV files

Questions? CS-1004, A-Term 2014 CSV files

Homework #6 Plotting civic data on a map Two data sets Crime records in Sacramento, CA for January 2006 Real estate transactions in Sacramento region for one week in May 2008 Both as CSV files Each record includes latitude and longitude Draw colored circles on map of region Using graphics package from textbook graphics.Image() object CS-1004, A-Term 2014 CSV files

Apologia Homework assignment not yet on course web site As soon as possible Due Monday, October 13 CS-1004, A-Term 2014 CSV files

Questions? CS-1004, A-Term 2014 CSV files