Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Machine Learning for Finnace & Accounting Level Three ยท Lesson 2 of 10

Module One

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
2
Module 1: Financial Data Foundations & Feature Engineering for Young Coders
โญ Module 1 ยท Level Three

Financial Data
Foundations

๐Ÿ’ฐ Where does money data come from โ€” and how do we make it ML-ready?

๐ŸŽฏ What you'll learn in this module

  • โœ” Where financial data comes from (ledgers, banks, markets)
  • โœ” The basics of time-series data in finance
  • โœ” How to handle missing values, outliers, and restatements
  • โœ” How to build features with lags, rolling windows, and ratios
  • โœ” The most important accounting ratios for ML
  • โœ” The sneaky trap of data leakage โ€” and how to avoid it
๐Ÿฆ
Where Does Financial Data Come From?
Data Sources

Financial data doesn't appear from nowhere โ€” it flows from many sources:

Source What It Contains Example
๐Ÿ“’ Ledgers Every transaction recorded by a company Sales, purchases, payroll entries
๐Ÿข ERP systems Combined business data (inventory, HR, finance) SAP, Oracle Financials
๐Ÿ“ˆ Market feeds Real-time stock prices, exchange rates Bloomberg, Yahoo Finance
๐Ÿ“„ Financial statements Summaries released quarterly or annually Income statement, balance sheet
๐Ÿšฐ Financial data is like water flowing into a house from many pipes. Before you can drink it, you need to filter and clean it.
๐Ÿ“…
Time-Series Basics for Finance
Time Series

Most financial data is a time series โ€” a sequence of values recorded over time. Think of a stock price, a company's monthly revenue, or your bank balance.

Key idea: order matters. Yesterday's value usually tells you something about today's. That's totally different from random data like survey answers. We'll learn to respect time in every model we build โ€” never peek into the future.

๐Ÿ“– A time series is a diary: each entry builds on the last. If you shuffled the pages, the story wouldn't make sense.
๐Ÿงฝ
Handling Missing Values, Outliers & Restatements
Cleanup

Real financial data is messy. Three common problems:

Missing values: a payment wasn't recorded. Fill in with a reasonable estimate โ€” or mark it clearly and let the model handle it.

Outliers: a huge transaction that doesn't fit the pattern. Sometimes real (a big sale!), sometimes a typo (someone added an extra zero). Investigate before deleting.

Restatements: a company re-reports past numbers. Use the latest restated values, and never mix old and new numbers.

๐Ÿงน Cleaning data is like tidying up after a party: you don't throw away everything โ€” you find what's valuable and set aside what's spoiled.
๐Ÿ”จ
Feature Engineering: Making Data Smarter
Craft

Raw data is like a block of wood. Feature engineering shapes it into something a model can use. Two of the most powerful techniques:

Lags: use yesterday's or last month's value as a feature. revenue_t-1 helps predict revenue_t.

Rolling windows: summarize the last N periods. average_revenue_last_3_months smooths out noise and captures trends.

Both tell the model: "here's what happened recently, now predict what's next."

๐Ÿ“… Raw time series
โ†’
๐Ÿ”จ Add lag features
โ†’
๐Ÿ“Š Add rolling stats
โ†’
๐Ÿค– ML-ready data
๐Ÿช Raw flour is just flour. Add eggs, sugar, and butter (lags and rolling stats) โ€” now you have cookie dough (feature-engineered data) ready to bake.
๐Ÿ“
Accounting Ratios: The ML-Ready Metrics
Finance

Accountants have been computing ratios for over a century โ€” and for good reason. Ratios pack a lot of information into one number. Some favorites:

Ratio Formula What It Tells You
Profit Margin Net income รท Revenue How much profit per dollar earned
Current Ratio Current assets รท Current liabilities Can the company pay its short-term bills?
Debt-to-Equity Total debt รท Total equity How much is borrowed vs. owned
Return on Equity (ROE) Net income รท Equity How well the company uses investor money

For ML, ratios are features โ€” they let the model compare companies of different sizes fairly.

โš–๏ธ A ratio is like a scale: "20% off" means more than "save $20" โ€” it works no matter the original price.
๐Ÿšจ
Data Leakage: The Sneakiest Mistake
Danger

Data leakage happens when your model accidentally sees information it wouldn't have at prediction time. It looks great in testing and then fails in real life.

Examples: using tomorrow's stock price as a feature to predict today's. Or using "total revenue at year-end" to predict monthly sales โ€” you wouldn't have that at month-end.

Rule of thumb: at prediction time, only use what you would actually know at that moment. If a feature "feels too good to be true," it probably is.

๐Ÿ“ Leakage is like a student who saw the answers before the test. Great score โ€” but they didn't actually learn anything.
โš ๏ธ Golden rule: When splitting data into "training" and "testing," always split by time, not randomly. Train on the past, test on the future. Random splitting in finance is a classic way to accidentally leak information and fool yourself.

๐Ÿ› ๏ธ Hands-on activities (no boring stuff!)

1

Source scavenger hunt: List 5 places financial data exists in your daily life (bank statements, receipts, school fees, stock apps, chore money). For each, note whether it's time-ordered.

2

Clean the toy dataset: Take a small CSV with 10 rows, 2 missing values, and 1 obvious typo (like a price of 1000000). Decide how to handle each case and document your decision.

3

Lag feature lab: Given a list of 10 monthly sales numbers, create a new column that shifts them by 1 (so the value at month 2 is the sales from month 1). Notice how the first row becomes empty โ€” that's real and expected.

4

Rolling average: Extend your dataset with a "3-month rolling average" column. Compare a single month's raw value to the smoothed value. Which is easier to spot a trend in?

5

Ratio practice: For a company with net income 50, revenue 500, and equity 250, compute profit margin and ROE. Then do the same for a company twice the size. Compare โ€” did the ratios change as much as the raw numbers?

6

Leakage detective: Review three example features and identify which would leak information: (a) "sales from last month," (b) "end-of-year total revenue," (c) "number of items sold yesterday." Explain your choices.

๐Ÿ†

By the end of this module, you'll be able to: identify financial data sources, explain time-series basics, clean messy financial data, create lag and rolling-window features, compute key ratios, and avoid the trap of data leakage.

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’