CSV File Manipulation.

Slides:



Advertisements
Similar presentations
Microsoft Excel 2002 Microsoft Excel is a powerful spreadsheet program that helps you to organize data complete calculations make decisions graph data.
Advertisements

Table, List, Blocks, Inline Style
Chapter 3 – Web Design Tables & Page Layout
Working with Tables for Page Design – Lesson 41 Working with Tables for Page Design Lesson 4.
With Microsoft ® Excel 2010© 2011 Pearson Education, Inc. Publishing as Prentice Hall1 GO! with Microsoft ® Excel 2010 Chapter 1 Creating a Worksheet and.
Introduction to Microsoft Excel 2010 Chapter Extension 3.
Excel Formatting. Format Cells… Right-mouse click in the spreadsheet to bring up this drop-down menu.
Page margin margin for header and footer. page size page orientation.
Copyright 2003, Paradigm Publishing Inc. CHAPTER 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Print Preview Formatting Column Widths Row Heights Format Numbers.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
1.  Formatting is applied to spreadsheet components for the purpose of organizing and clarifying information.  Data that is presented in a uniform and.
Create a table Resize, split and merge cells Insert and align graphics within table cells Insert text and format cell content Maintain Web site Working.
 Cut and paste sometimes works  More likely want to go to temp sheet  Get it in any way you can  AND THEN clean it up.
Designing a Database Unleashing the Power of Relational Database Design.
Computers Are Your Future © 2008Prentice-Hall, Inc.
The University of Adelaide Table Talk: Using tables in Word Peter Murdoch March 2014 PREPARING GOOD LOOKING DOCUMENTS.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 06: Tables - Spring 2011.
1 Access Lesson 6 Integrating Access Microsoft Office 2010 Introductory Pasewark & Pasewark.
File Types, MS Word, and MS Excel
1 Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall. To widen a column to an exact width, do one of the following: Drag the vertical.
Using Excel Session 2 Dr. Gary Briers Texas A&M University.
Adobe Dreamweaver CS3 Revealed CHAPTER FIVE: USING HTML TABLES TO LAY OUT A PAGE.
The Advantage Series ©2004 The McGraw-Hill Companies, Inc. All rights reserved Chapter 8 Managing Worksheet Lists Microsoft Office Excel 2003.
Chapter 19 Managing Worksheet Lists. Creating Lists ► Microsoft Office Excel 2003 is inarguably the most powerful electronic spreadsheet available. ►
10/3: Using Microsoft Excel
4 Chapter Four Introduction to HTML. 4 Chapter Objectives Learn basic HTML commands Discover how to display graphic image objects in Web pages Create.
CIS234A Lecture 8 Instructor Greg D’Andrea. Review Text Table contains only text, evenly spaced on the Web page in rows and columns uses only standard.
CCS – Mail Merge Mail Merge This presentation is incomplete without the associated discussion 1 Coloma Community Schools In-service 21 March 2014.
MySQL Importing and creating a database. CSV (Comma Separated Values) file CSV = Comma Separated Values – they are simple text files containing data which.
CHAPTER 17 INTRODUCTION TO SPREADSHEETS. SPREADSHEETS Application Software designed to aid users in entering, moving,copying, labeling, displaying and.
A table is a set of data elements (values) that is organized using a model of vertical columns (which are identified by their name) and horizontal rows.
1.  Formatting is applied to spreadsheet components for the purpose of organizing and clarifying information.  Added to present data in a uniform and.
Key Applications Module Lesson 14 — Working with Tables Computer Literacy BASICS.
Microsoft® Access Generate forms quickly 1 Modify controls in Layout View 2 Work with form sections 3 Modify controls in Design View 4 Add calculated.
CS134 Web Design & Development Attributes, Lists, Tables, Links, and Images Mehmud Abliz.
Day 1: MS Excel for Beginners Aniko Balogh CEU Computer & Statistics Center
Welcome To MITT Electronic Spreadsheet Class (MS/Excel 2007)
Advanced Excel Helen Mills OME-RESA.
Multi-Axis Tabular Loads in ANSYS Workbench
Formatting a Spreadsheet
Creates the file on disk and opens it for writing
Formatting Worksheet Elements
INPUT AND OUTPUT.
ASP.NET Web Controls.
Microsoft Excel A Spreadsheet Program.
Microsoft Office Illustrated
Formulas A formula is a sequence of values, cell references and operators that produce a new value. = E8 + 3*(E10 - E11) Formulas always start with an.
Data Migration to DOORS DNG Presented By Adam Hammett
Spreadsheet Formatting
Spreadsheet Formatting
Microsoft Excel 101.
Creates the file on disk and opens it for writing
PowerPoint Create charts and tables
Spreadsheet Formatting
8.02 Spreadsheet Formatting
Spreadsheet Formatting
Do you know what these buttons do?
Usually use background-color:
Spreadsheet Formatting
Spreadsheet Formatting
Excel: Formatting Participation Project
Spreadsheet Formatting cleanvideosearch
CSV Files and ETL The Good, Bad, and Ugly
Do you know what these buttons do?
Lesson 5: HTML Tables.
Formatting Content in Word
Microsoft Excel.
Changing the Appearance of a Worksheet
Key Applications Module Lesson 14 — Working with Tables
Presentation transcript:

CSV File Manipulation

Structured Text Files Simple text files are a collection of lines with an escape sequence at the end of each line. There is no definitive way to identify specific pieces of information unless there is a specified format to the file. Ex. /etc/passwd username:*:UID:GID: name: home Path: shell However there are several structured files Tab Delimited – values separated with a tab CSV – values separated with a ‘,’ HTML/XML – tags , ‘< >’

Comma Separated Values Delimited files are a common format often used as an exchange format for spreadsheets and databases. Each line in a CSV file represents a row in the spreadhseet Usually there is a header that denoted each of the column names. Since CSV’s are a formatted text file they can still have end of line escape sequences CSV vs escel and otherspreadsheets No types – all strings No fonts, sizes or colors No multiple worsheets No cell widths or heights No merged cells No images or charts ID Term Course Grade 800412564 201652 ISY150 A 800798465 CIS120 800125498 C 800174658 CIS150 F

Manipulating CSV Files vs. plain Text files Since CSV files are just formatted text files the process to read them is similar to processing text files. Create a file stream, create reader/writer object, process the reader/writer, close stream When files are read in they need to be processed as lists(arrays) and each element is a unique element in the array that does not need to be split. There is a unique module for processing csv files Code: import csv

Read CSV Example import csv exFile = open(‘example.csv’ , ‘r’) exReader = csv.reader(exFile) for row in exReader: print row exFile.close() import csv exFile = open(‘example.csv’ , ‘r’) exReader = csv.reader(exFile) exReader = list(exReader) for i in (0, 10, 1): print exReader[i] exFile.close()

Write csv Example import csv outFile = open(‘outputFile.csv’, ‘w’) outWriter = csv.writer(outFile) outWriter.writerow([‘Date’, ‘ID’, ‘GPA’]) outWriter.writerow([’01/12/2015’, ‘700514323’, ‘3.0’]) outWriter.writerow([’01/12/2015’, ‘700645798’, ‘2.64’]) outFile.close()

Process CSV Files in a directory example import csv, os for currFile in os.listdir(‘~/Documents’) if (not currFile.endswith(‘.csv’)): continue else: # process csv file