csv_io/

directory
v0.0.0-...-86d22a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2017 License: Apache-2.0

README

CSV Data Input/Output/Parsing

Although the CSV data you will work with is not likely to be "big" (whatever that means), it is important. As a data scientist, you will most definitely have to work with CSV data, because it is such a common format for data sets downloaded from the government, survey sites, marketers, etc. Also, it is common to provide results, aggregations, etc. to colleagues in CSV format.

Notes

  • encoding/csv reads in CSV records as strings.
  • Unexpected types should be handled while parsing records.
  • Set an expected fields per record whenever possible.
  • Check for empty values in a string column with the zero string value "".

encoding/csv docs

Code Review

Read in CSV records
Handle unexpected fields
Handle unexpected types
Save a CSV file

Exercises

Exercise 1

Parse iris_multiple_mixed_types.csv. Define expected types for all of the columns in the CSV file and log any errors indicating unexpected types.

Template | Answer

Exercise 2

Save the parsed and cleaned iris_multiple_mixed_types.csv to a file called processed.csv.

Template | Answer


All material is licensed under the Apache License Version 2.0, January 2004.

Directories

Path Synopsis
Sample program to read in records from an example CSV file.
Sample program to read in records from an example CSV file.
Sample program to read in records from an example CSV file, and catch an unexpected extra field in the data.
Sample program to read in records from an example CSV file, and catch an unexpected extra field in the data.
Sample program to read in records from an example CSV file, and catch an unexpected types in a single column.
Sample program to read in records from an example CSV file, and catch an unexpected types in a single column.
Sample program to save records to a CSV file.
Sample program to save records to a CSV file.
exercises
exercise1
Sample program to read in records from an example CSV file, and catch an unexpected types in any of the columns.
Sample program to read in records from an example CSV file, and catch an unexpected types in any of the columns.
exercise2
Sample program to read in records from an example CSV file, catch an unexpected types in any of the columns, and output processed data to a different CSV file.
Sample program to read in records from an example CSV file, catch an unexpected types in any of the columns, and output processed data to a different CSV file.
template1
Sample program to read in records from an example CSV file, and catch an unexpected types in any of the columns.
Sample program to read in records from an example CSV file, and catch an unexpected types in any of the columns.
template2
Sample program to read in records from an example CSV file, catch an unexpected types in any of the columns, and output processed data to a different CSV file.
Sample program to read in records from an example CSV file, catch an unexpected types in any of the columns, and output processed data to a different CSV file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL