Giter VIP home page Giter VIP logo

data-wrangling-python-nicar-2017's Introduction

Data Wrangling With Python: NICAR 2017

This repository contains materials for "Data Wrangling With Python," a hands-on session presented at the 2017 Investigative Reporters and Editors NICAR conference in Jacksonville, Fla.

The code covers basic import, transformation, and export of data from CSV files. Output formats include JSON and SQL table creation statements.

What You'll Need

This code was written and taught on MacOS Sierra using Python 3.6; it should work fine on Python 2.7 as well as Python 3.5+. It's not been tested on Windows. I recommend setting up a virtual environment and then installing the following dependencies:

Here are the steps:

Setup for Jupyter Notebook Exercises

  1. Open your terminal and navigate to the Desktop:

cd ~/Desktop

  1. Clone this repository:

git clone https://github.com/anthonydb/data-wrangling-python-nicar-2017.git

  1. Change to the project directory you just cloned:

cd data-wrangling-python-nicar-2017/

  1. Set up your virtual environment. We'll call it 'nicar':

virtualenv nicar

source nicar/bin/activate

  1. Install your dependencies:

pip install agate csvkit requests jupyter

  1. Now you can run Jupyter Notebook:

jupyter notebook

  1. Jupyter Notebook will open in your default browser on localhost:, and you will see a list of files in the directory. The most important file for this exercise is the Census 2010 data contained in us_counties_2010.csv.

  2. Next, using the "New" menu at the top right of the Jupyter Notebook app, create a new notebook matching the version of Python on your system.

  3. Now, you can paste in the code found in the .ipynb file in this repository and run it to follow the tutorial.

  4. When you're done, run ctrl+c in the terminal to close Jupyter Notebook. Then deactivate to exit your virtual environment.

Trying csvkit Commands

You can run the commands in the file csvkit-notes.md in your terminal. Make sure the virtual environment is activated.

Notes and Further Reading

This NICAR 2017 hands-on class was loosely inspired by the structure of a NICAR 2016 class taught by Jacqueline Kazil and Abraham Epton.

Suggested resources to learn more about Python and data:

data-wrangling-python-nicar-2017's People

Contributors

lindsaycarbonell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.