Skip to main content
Build a book from pandas tables, and check it against the line’s schema:
Each row of submissions is one request to price. drivers, vehicles and coverages link to it by submission_id. The book adds the policies table from each policy_id.

Put facts in the core columns

  • Put each reported fact in its core column, such as birth_date. The PPA book schema lists each column.
  • Leave an unknown fact blank. Each program sets its own default for a blank.
  • Keep values that a carrier derives, such as an age or a territory, out of the book. A program’s prepare derives them.
Book checks every table, key and type when you build it, and raises BookError with each problem at once.

Read a book from CSV files

Write one CSV file per table in a folder, such as vehicles.csv. Read the folder with the schema:
read_csv reads IDs and codes as text exactly as spelled, so a postal code keeps its leading zero.

Start from the example book

The example program carries a book of 100,000 synthetic California policies. The other guides use it as the running book:
Load a program describes the library and its API key.

Select policies

Select whole policies, with each of their rows:

Add a column of your own

Change a copy of a table in pandas, and pass it to with_tables. The book keeps your column through every step, so results join to it by submission_id:
A book stays the same after you build it. with_tables returns a new book, and each table property returns a copy.