Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Files and code for a Python 1 hands-on session at NICAR18 in Chicago

Outline for hands-on session

  1. Open a Jupyter notebook file (link to download)

    • Remember - hit Shift-Enter to run a cell!
  2. Overview of why this is a good language to learn on, how it may be different from others

    • Reliance on indentation
    • Loose vs. strict typing
    • Lots of built in functions and modules that can be imported
    • (Show XKCD comic here:
    • Do basic math
    • Print out some text
    • Integrate result in a sentence
    • Print it out
  3. Data types

    • Variables
    • Numbers
    • Strings
      • Important functions:
        • Slice (use numeric indices, -1 counts from end)
        • Lower/upper
        • Strip
        • Startswith
        • Find - look for a string within a string
    • Booleans
    • Lists
      • Join function
    • Dictionaries
  4. Iteration

    • Demonstrate sample with a list like ["dog", "cat"]
    • Take our data file and load each row individually, to show what looping is

    • Why do we use comments?
    • How do we add them to a file?
  6. Importing modules

    • Load a sample module
    • Where do we load it?
    • What name do we use when referring to it?
    • What's the difference between targeting a library and a module? (ex: from x import y)
    • import datetime oTime = print oTime.isoformat()
  7. Pip (to gain access to more modules)

  8. Start use of Pandas to load and manipulate file

    • find current directory with os.getcwd()
    • We will use this file:
    • import pandas as pd
    • input = pd.read_csv(PATH_TO_SEX_OFFENDERS_DATABASE);
    • #row
    • input.iloc[1]
    • #column
    • input['TOTAL CASES']
    • #row and column
    • input.iloc[3]['TOTAL CASES']


Files and code for a Python 1 hands-on session at NICAR18 in Chicago



No releases published


No packages published