Skip to content
Learn Python with BNHR

Module 5 · Intermediate

Recode and tabulate

Module 5 of Python for Survey Statistics: categories from codes with mapping tables, np.select and pd.cut, distinct counts at national, regional and provincial levels, and the tabulation frame. Its sections, its notebooks to read on the web, and the companion's solutions and explanations.

Module 5Level Intermediate
On this page
  1. Overview
  2. What you do
  3. The module’s notebooks
  4. Quizzes
  5. Certification and support

A statistical table starts as codes. This module turns them into categories: education groups from the code list with a mapping table, a member’s role in fishing from four flags with np.select, age groups with pd.cut, and the top eight species with the rest as Other, keeping blanks and codes out of range visible rather than lost.

Then it counts distinct operators, fishing units and households at national, regional and provincial levels, in pandas and polars, and builds the tabulation frame, one row per unit with its classifications and its design columns, that module 6 estimates from.

  1. Categories from codes: mapping tables, np.select, pd.cut, top-N with other
  2. Distinct counts by group at national, regional and provincial levels
  3. The tabulation frame an estimate is computed from

The notebooks are in your course folder; here you can read them without running anything. For reference in any module: primer: from r to python and primer: survey sampling in one page and glossary.

Quizzes

  • Check-inAt the end of the module. A short check on “Recode and tabulate”, and how ready you feel; its answers show as soon as you submit.Check-in: Recode and tabulate ↗

The quizzes are on BNHR Quizzes and count toward nothing. Learning on your own, a quiz opens as the self-paced one; while a training runs, it asks which training you are in.

Saved in this browser only

Certification and support

We offer additional resources, certificates, ongoing support, and other perks to those who join our instructor-led training.

Join an upcoming training to take this as an instructor-led course, or contact us to arrange one for your team or organization.

Something new

Identify results
LayerExplore a module
ModuleStore: rules that hold in the database
AboutModule 4 of Python for Data Management: a database whose rules come from the contract, loaded all or nothing. Its sections, its notebooks to read on the web, and the companion's solutions and explanations.
CoursePython for Data Management, free