PeaBox Lab › PeaLang › Learn › Chapter 18

Part III — Advanced Systems · Chapter 18

Time Series and Forecasting

Chapter 16 treated a table as a set of rows with no inherent order. Chapter 17 brought data in from databases, APIs, and object stores. Many of those sources produce records stamped with a time: daily sales, hourly sensor readings, monthly invoices, minute-by-minute queue lengths. When time is the organizing column, row order carries meaning, gaps become information, and the past is used to say something careful about the future.

This chapter teaches the time-series toolkit in the order a practitioner uses it: build date features and align data to a regular frequency; compute lags, differences, and rolling statistics; repair gaps and separate trend from seasonality; split data honestly by time and measure error; build baseline forecasts that every later model must beat; and finally produce grouped forecasts with uncertainty bands in a shape that dashboards can consume.

Release note. In v0.63 the data layer is exposed mainly through the Python host package (pealang.data). Time-series listings in this chapter are marked illustrative: they show the operations and their contracts using readable method names. Confirm exact function names and arguments in the module reference of your installed version (pea --version) before copying them into production code. The reasoning, checks, and failure modes apply regardless of the exact spelling.