Load up and look at some data

Python for R Users

Daniel Chen

Instructor

Overview

  • 2013 NYC Flights
  • Load and Explore
  • Manipulate and plot
Python for R Users

Importing data with list comprehensions

  • List comprehension to load data
  • Saves repetitive typing
  • Condensed way of appending values to a list
Python for R Users

List comprehensions

import glob
import pandas as pd
csv_files = glob.glob('*.csv')
csv_files
['data3.csv', 'data2.csv', 'data1.csv']
all_dfs = [pd.read_csv(x) for x in csv_files]
all_dfs[0]
    A   B   C   D
0  a0  b0  c0  d0
1  a1  b1  c1  d1
2  a2  b2  c2  d2
3  a3  b3  c3  d3
Python for R Users

Let's practice!

Python for R Users

Preparing Video For Download...