Skip to content

Track T33

Python ≡ R

One idea in two dialects and the defaults that differ.

Unit 1Two dialects

· 2 lessons
  1. 1One idea, two dialectsRead an analysis in Python and in R side by side, and see which differences are spelling and which change the answer.Introductory · 7 min
  2. 2Data frames in pandas and dplyrFilter, add columns, group and join in both languages, and let a recipe write the translation for you.Introductory · 9 min

Unit 2Default traps

· 3 lessons
  1. 3Default traps: standard deviations and quantilesThe same-looking function gives different answers. Learn the two most common cases, where numpy's standard deviation and every package's quantile hide a choice.Applied · 8 min
  2. 4Default traps: missing valuesR stops at missing values, pandas skips them, numpy poisons the result, and a regression can quietly drop rows. Know which you are getting.Applied · 8 min
  3. 5Default traps: statistical testsscipy's two-sample t test assumes equal variances and R's doesn't. Two more common tests have traps of the same kind. Learn them, and name your options.Applied · 10 min

Unit 3Modeling defaults

· 3 lessons
  1. 6Factors, reference levels and contrastsA categorical predictor becomes numbers before a model sees it. Both languages pick a reference level for you, and changing it changes every coefficient you read.Applied · 8 min
  2. 7Type I, II and III sums of squaresSwap two predictors in an unbalanced ANOVA and R's anova() gives a different F. Learn what each type tests, and why generated code always names one.Advanced · 9 min
  3. 8Intercepts and penaltiesOne Python regression API leaves out the intercept, and scikit-learn's logistic regression is penalized by default. See what each does to your coefficients.Applied · 8 min

Unit 4Reproducing results

· 2 lessons
  1. 9Seeds and shared random streamsThe same seed gives different numbers in Python and R. See why, what the app does about it, and what a seed does and doesn't promise.Applied · 8 min
  2. 10When the two engines disagreeA checklist for reconciling two results, in the order that finds the cause fastest, and how to read a known difference.Advanced · 10 min