Introduction

Python for R Users

Daniel Chen

Instructor

The basics

  • Variables
  • Assignment
  • Strings
  • Lists
  • Dictionaries
Python for R Users

Programming fundamentals

  • Control flow (if-statements)
  • loops
  • Functions
Python for R Users

Pandas

  • Selecting and subsetting data
  • Data types
  • Data manipulation and processing techniques
Python for R Users

Plotting

  • pandas
  • matplotlib
  • seaborn
Python for R Users

Putting it all together

  • NYC Flights 2013 Dataset
  • Planes
  • Flight Delays
Python for R Users

Python data types

R
  • numeric: integers, floating point numbers
  • logical: TRUE or FALSE values
  • character: strings
Python
  • int: integers
  • float: floating point numbers
  • bool: True or False values
  • str: strings
Python for R Users

Assignment

R
x <- 3

y = 0.5

z <- TRUE
Python
x = 3

y = 0.5

z = True
Python for R Users

Print statements

R
print('R is awesome!')
"R is awesome!"
Python
print('Python too!')
Python too!
Python for R Users

What's your data type?

R
x <- 3

class(x)
"numeric"
Python
x = 3

type(x)
int
y = 0.5

type(y)
float
Python for R Users
R
1 + 1
2
'1' + '1'
Error in "1" + "1" : non-numeric argument to binary operator
'1' * 5
Error in "1" * 5 : non-numeric argument to binary operator
'1' '1'
Error: unexpected string constant in "'1' '1'"
Python for R Users
Python
1 + 1
2
'1' + '1'
'11'
'1' * 5
'11111'
'1' '1'
'11'
Python for R Users

Let's practice!

Python for R Users

Preparing Video For Download...