Fin Maverick
Foundations VocabularyAccounting & ReportingEconomics & MacroQuant Methods & ProgrammingBusiness & Company AnalysisCorporate Finance & ValuationBehavioural Finance
Banking & Market InfrastructureFixed Income & RatesDerivatives & Structured ProductsPublic EquitiesTransactions & DealsPortfolio ConstructionFunds & AMCs
Private Markets & AlternativesRisk, Treasury & ControlAI & Digital FinanceStochastic Calculus & PricingWealth & Personal FinanceIndian Markets & RegulationProfessional Practice
CalculatorComparison
Frameworks
Explore Bootcamps
Equity ResearchPortfolio ManagementMutual Fund MasteryFinancial LiteracyInvestment Banking Analyst
Private Equity AnalystHedge Funds AnalystBreaking Into VCBreaking Into QuantsAI For Finance
Financial Analyst ProgramRisk Management ProgramPrivate Wealth ManagementDebt Capital MarketsDerivatives Foundation
Explore Internships
Equity Research InternMutual Fund Intern
Portfolio Management InternFinancial Literacy Intern
Explore Micro Courses

Equity Research6

Writing an Investment ThesisBuilding a Discounted Cash FlowReading an Annual Report FastReading a Sector Before a CompanySpotting Quality of Earnings Red FlagsBuilding a Revenue Forecast From Drivers

Portfolio Management3

Rebalancing: When, Why and What It CostsStrategic and Tactical Asset AllocationMeasuring Risk in a Portfolio

Mutual Fund Mastery3

Comparing Funds Without Being FooledHow a NAV Is Struck and Which Day You GetReading a Fund Factsheet Properly

Derivatives Unlocked4

Hedging a Real ExposureThe Greeks, PracticallyFutures, the Basis and What Moves ItReading an Option Payoff

AI For Finance2

Retrieval and Grounding for FinanceDocument Extraction in Finance

Breaking Into Quants4

Backtesting a StrategyHypothesis TestingCleaning Financial DataRegression for Finance

Breaking Into VC3

Sizing a MarketReading a Term Sheet as a FounderHow a Venture Round Actually Works

Financial Analyst Program4

Common Size and Trend AnalysisReading a Cash Flow StatementRatio Analysis That Says SomethingBuilding a Working Capital Schedule

Risk Management Program2

Credit Exposure and How It Is ReducedValue at Risk and What It Hides

Investment Banking Analyst3

Precedent Transactions and Why They DifferReading a Term Sheet StructurallyBuilding a Comparable Companies Table

Private Wealth Management3

Tax Aware Portfolio DecisionsBuilding a Client Risk ProfileGoal Based Planning Arithmetic

Debt Capital Markets3

Analysing an Issuer's CreditDuration and What It Does Not Tell YouBond Pricing and Yield Mechanics

Private Equity Analyst2

Fund Waterfalls and CarryThe LBO in Structure

Hedge Funds Analyst2

Short Selling MechanicsLong Short Mechanics
Courses
Explore Career Roadmaps
Investment Banking AnalystEquity Research AnalystVC AnalystPrivate Equity AnalystHedge Funds Analyst
Quant AnalystAI For FinanceFinancial Analyst ProgramPrivate Wealth ManagementDebt Capital Markets
Risk Management ProgramDerivatives FoundationPortfolio ManagementMutual Fund Mastery
PartnershipsShowdown
Log inSign up
Quant Analyst · CoreTrack
1Quantitative Methods, Financial Data & Programming
iProbability
Probability in FinanceRandom VariableProbability DistributionsThe Normal DistributionNormal Distribution ProbabilityThe Lognormal DistributionRandomness vs Uncertainty
iiStatistics and Inference
Population and SampleMean, Median and ModePrecision and AccuracyVariable TypesVariance, Standard Deviation and…Dispersion MeasuresStatistical BiasEffect SizeHypothesis TestingThe Sampling DistributionSkewnessKurtosisCovarianceConfidence IntervalArithmetic Mean vs Geometric MeanStatistical Significance vs Economic…Confidence Interval vs Prediction IntervalHow to Summarise a…
iiiCorrelation and Regression
RegressionCorrelation and CausationOrdinary Least SquaresInteraction TermsRegression CoefficientsRegression vs ClassificationHow to Build a…Spurious CorrelationRegression, Correlation and FitResidualsMulticollinearityAutocorrelation and Partial Autocorrelation
ivTime Series
Time Series in FinanceSimple, Weighted and Exponential…Moving Average CalculatorPrice, Return and Level SeriesHow to Prepare Time-Series…LagFrequencySeasonalityTimestampsTrendStationarity and the Unit RootHeteroskedasticityLeadRolling WindowsDifferencing
vSimulation and Numerical Methods
SimulationMonte Carlo SimulationHow to Run a…Numerical MethodsIterationResampling and the BootstrapPseudorandom Numbers and the SeedConvergence and ToleranceNumerical Stability
viOptimisation
OptimisationLocal and Global OptimaConstraintsConvex OptimisationThe SolverLinear ProgrammingThe Objective FunctionConstraint ViolationThe Feasible SetLagrange MultipliersQuadratic Programming
viiModelling Practice
Linear, Logistic, Ridge and…Training, Validation and Test…The ModelModel ErrorDependent and Independent VariablesThe ROC Curve and AUCWhat a Model HoldsMSE, RMSE, MAE and MAPEPrecision and RecallCross Validation and RegularisationOverfitting and UnderfittingReturn Series MeasuresSimple, Compound and Log Return
viiiBacktesting and Research Integrity
BacktestingBacktest vs Live PerformanceHow to Document a…How to Prevent Backtest…Out-of-Sample TestingWalk-Forward AnalysisMultiple TestingP-HackingData Snooping
ixData Quality and Structure
Data QualityThe DatasetSelection and Survivorship BiasVersioned DatasetsData Structures in FinanceData CleaningMissing Data and Null ValuesStructured Data vs Unstructured DataMissing Data vs ZeroData Validation vs Data CleaningOutliersDuplicate Records
xProgramming for Finance
Data PipelinesAPIs for Financial DataAPI vs CSV FileDatabases in FinancePython for FinanceJoinsSQL for FinanceThe Analysis Workflow
xiQuantitative Research
Research DesignThe Data Generating ProcessReproducibilityPeer Review in Analytical WorkThe Research HypothesisRobustness and Sensitivity
2Stochastic Calculus & Derivative Pricing Theory
iProbability Foundations
The Probability SpaceRandom VectorsSigma-AlgebraExpectationSample Space and EventsDensity and Distribution FunctionsRisk-Neutral ProbabilityState Price Density vs…
iiStochastic Processes and Jumps
Properties of a Stochastic ProcessMartingaleBrownian Motion and Its PropertiesBrownian Motion vs Geometric…Stopping TimeThe Markov PropertyState VariablesTransition ProbabilityQuadratic VariationQuadratic Variation vs Ordinary…Submartingale and SupermartingaleMartingale RepresentationMarkov Process vs MartingaleOptional StoppingFiltrationJump ProcessesThe Poisson ProcessLevy ProcessesJump Diffusion
iiiIto Calculus
The Ito IntegralThe Ito Integral vs the Riemann IntegralInfinitesimals in Stochastic CalculusQuadratic CovariationIto's LemmaHow to Apply Ito's…The Infinitesimal GeneratorIto Calculus vs Ordinary Calculus
ivStochastic Differential Equations
Stochastic Differential EquationsStochastic Differential Equation vs…Drift and DiffusionStrong and Weak Solutions ComparedDiscretisationGeometric Brownian Motion
vPricing Theory and No-Arbitrage
No-ArbitrageGirsanov, Radon-Nikodym and Change…Physical and Risk-Neutral Measures…The Fundamental Theorems of…The Law of One PriceThe Pricing KernelDiscount Factors and Zero-Coupon PricesReplication vs HedgingComplete Market vs Incomplete MarketClearing Margin Architecture
viOption Pricing Theory
European and American OptionsMonte Carlo European OptionThe Black-Scholes PDEBlack Scholes and the GreeksThe Payoff FunctionThe Binomial ModelBinomial Option PricingDelta Hedging in TheoryBoundary, Initial and Terminal ConditionsThe Exercise BoundaryHow to Check Put-Call…
viiVolatility Models
Constant, Local and Stochastic…Vasicek Model vs CIR ModelThe Heston ModelThe SABR ModelThe Volatility ProcessImplied VolatilityVolatility Smile vs Skew vs Surface
viiiInterest Rate Models
Interest-Rate DerivativesMean ReversionThe Zero-Coupon BondThe Ornstein-Uhlenbeck ProcessThe Discount CurveZero RatesShort-Rate Model vs Market Model
ixNumerical Pricing
Closed Form and Numerical…Monte Carlo PricingEuler and Milstein Schemes ComparedTree MethodsFinite Difference MethodsNumerical Error and StabilityVariance Reduction
xCalibration and Model Risk
Model OverrideMarket Price and Model PriceCalibrationHow to Document a Pricing ModelThe Educational Illustration LabelMarket ConventionsModel Uncertainty and LimitationsBacktesting a Pricing ModelIdentifiabilityCalibrated ParametersThe Calibration Loss Function

Duplicate Records: How They Arise and What They Distort

A duplicate is two rows answering the same question, and an exact copy is the rare case. In the Neelbagh stall record, invented for teaching, stall NB-03 filed month 2 twice: Rs 36,400/- on day 5 and Rs 39,700/- on day 19. A check that matches whole rows finds nothing. Five ways of settling it give three different published figures.

One quantity runs through everything below, so it is worth fixing before anything else moves. The sum of whichever takings cells hold a figure the convention allows, divided by how many cells went into that sum, is the arithmetic averageThe sum of the numbers divided by how many were added. The average is the only quantity needed anywhere below, and it is set out in full where this record was first printed. takings for each stall monthOne trader in one month. It is the thing a single row of this record is about, so a count of stall months and a count of rows are supposed to be the same count.. A cell left empty holds no number. Nor does the code standing in for a return that never reached the desk, however convincingly it sits in a column of rupees. A true zero does hold one. Every figure printed below carries its divisor alongside, since this record gives a different answer the moment the divisor changes.

Two counts from the opening notes here carry forward. The file the market office handed over has 32 rows, and those 32 rows carry 31 distinct combinations of stall and month. Under the convention just stated, the cleaned record gives Rs 54,196.55/- over 29 usable figures. Everything below is an argument about the gap between the first two of those numbers, and about what that gap does to the third.

What makes two rows duplicates, and why is an exact copy the rare case?

Two rows are duplicates when they answer the same question, whatever the rest of them says. The definition turns on the question a row answers, and says nothing about the contents. The definition directs attention to the columns that say what a row is about, and sets aside, for the purpose of this one test, every column that says what the answer was.

Consider the drawer where a household keeps its paper. The electricity bill for August arrives, gets opened, gets put in the drawer. Three weeks later the meter reading is queried and revised, and a corrected bill for August arrives. The corrected bill also goes in the drawer. Now there are two pieces of paper in there, and they are not copies of each other: the amounts differ, the dates differ, one carries the word revised across the top. Nobody would call them identical. But when the drawer is tipped out at the end of the year and every bill in it is added up, August lands in the total twice, and the year looks more expensive than it was.

The drawer is the shape of the whole subject. The two pieces of paper are duplicates because they answer one question, what August cost, and not because they look alike. The set of columns that carries the question has to be named first. Since the Neelbagh stall record is built to hold one row for each trader for each month, the key is the stall together with the month. Once that is named, the test is mechanical. Any pair of rows sharing a stall and a month is two answers where the record allows one, and a record that allows one and holds two has stopped being a record.

An exact copy, where every cell in one row matches every cell in the other, is the easy case and by a long way the rarer one. It happens when a file is appended to itself, or when the same import is run twice by mistake. An exact copy is easy: any tool finds it, and no judgement is needed about which copy to keep when the two are the same. Almost every duplicate that reaches a working record is not that. The ordinary duplicate is two rows that disagree somewhere, and the second one exists precisely to say something the first one got wrong.

A DUPLICATE IS DECIDED BY THE KEY COLUMNS, NEVER BY THE CONTENTS the shaded columns say what a row is about; the rest say what the answer was THE EXACT COPY every cell in one row matches the other STALL MONTH TAKINGS DAY NB-99 1 Rs 21,000/- 6 NB-99 1 Rs 21,000/- 6 any tool finds this, and it hardly ever happens THE ORDINARY CASE the key matches and the rest disagrees STALL MONTH TAKINGS DAY NB-03 2 Rs 36,400/- 5 NB-03 2 Rs 39,700/- 19 this is what actually turns up, and it hides BOTH PANELS HOLD A DUPLICATE. ONLY THE LEFT ONE ANSWERS TO A WHOLE ROW CHECK. The right hand pair disagrees in two cells, so nothing that compares rows cell by cell will ever pair them up.
Two rows count as duplicates when their key columns match, so the pair on the right is a duplicate even though two of its cells disagree, and only the pair on the left can be caught by comparing whole rows.
Try it out

What makes two rows in a record duplicates of each other?

Breaking Into Quants Bootcamp — Fin Maverick

What are the two rows in this record, and how do they differ?

NB-03 Harit Greens sent its month 2 return in on day 5 of the following month, reporting Rs 36,400/-. On day 19 the stall sent a revised returnA second form covering a period already reported, sent in to replace what the first one said. The word revised is doing real work: it means the sender is correcting themselves. for the same month, reporting Rs 39,700/-. The market office typed both of them into the record, in the order they arrived. Typing in what arrives is the only sensible thing a clerk can do with two pieces of paper. The whole of month 2 as it now stands appears below, printed so that the two rows sit together.

StallName as writtenMonthTakings cellFiled on day
NB-01Kadamba Idli2Rs 44,000/-7
NB-02Chandan Tea2Rs 33,000/-7
NB-03Harit Greens2Rs 36,400/-5
NB-03Harit Greens2Rs 39,700/-19
NB-04Peetal Utensils2Rs 0/-7
NB-05Bansi Flour2blank7
NB-06Ilaka Fruit2Rs 36,000/-7
NB-07Sundari Chaat2Rs 41,000/-7
NB-08Peeli Mithai2Rs 45,000/-7
Nine rows for eight stallstwo of them NB-03 

Across the two shaded rows, exactly how much of them agrees is visible. Stall the same. Name the same. Month the same. Two cells differ: the takings figure, by Rs 3,300/-, and the filed on dayThe column that records which day of the following month a form reached the office. It is a fact about the paper arriving, not about the trading it reports. column, 5 against 19. Nothing else in either row moves.

Neither of those rows is an error, and that is what makes this hard. Both are real filings. Both were typed in correctly. A visit to the market office to see the paper would turn up two forms, both signed, both genuine. There is no cell to correct, nobody to tell off and nothing to apologise for. The fault is not in a row at all. The record now answers one question twice and offers no way of choosing between the answers. A record that does that is a different kind of problem from a typing slip, and it needs a different kind of fix.

THE TWO ROWS NB-03 HAS IN MONTH 2, SET ONE ABOVE THE OTHER three columns agree exactly, two disagree, and none of the five is wrong STALL_ID STALL_NAME MONTH TAKINGS_RUPEES FILED_ON_DAY NB-03 Harit Greens 2 Rs 36,400/- 5 NB-03 Harit Greens 2 Rs 39,700/- 19 the stall and the month agree, and together they are the key this record turns on the takings differ by Rs 3,300/- and the filing day by fourteen, so no whole row check pairs them Both rows are real filings, correctly typed. The fault is the record holding two answers to one question.
NB-03's two month 2 rows agree on the stall and the month, which is the key, and disagree only on the takings figure and the day the form arrived.
Try it out

NB-03 filed month 2 twice, Rs 36,400/- on day 5 and Rs 39,700/- on day 19. Which of the two rows is the error?

AI For Finance Bootcamp — Fin Maverick

Why does a check on the whole row find nothing?

Handed this file and asked for duplicate rows, almost any tool will, unless told otherwise, compare every cell of every row against every cell of every other row and report back the pairs that match all the way across. Run against this record, that check returns zero. The only repeated key in the file belongs to two rows that disagree in two columns, so not one pair of rows in the Neelbagh stall record agrees in all eight.

Now ask a different question. Group byGather the rows that share a value and treat each gathering as one thing. Doing it in code belongs with the notes on programming for finance; here it is only the counting. stall and month, count the gatherings, and compare that count against the number of rows. The file has 32 rows and 31 gatherings. The whole finding is the gap of one between those two counts, and it is invisible to any test that looks at rows one at a time.

There is a trap sitting underneath this, and it is worth walking into on purpose. Eight stalls over four months is 32 stall months, so a clean record of this market would have exactly 32 rows. The Neelbagh stall record has 32 rows. A check of the row count alone would have found it correct and moved on. The count reads 32 because two faults pull opposite ways and land on nothing. NB-03's month 2 sits in the file twice, worth one row extra. NB-04's month 3 is not in the file at all, worth one row short. A month filed twice against a month never filed, and the total settles back exactly where a clean file would put it.

Faults in opposite directions hide inside a row count, so a row count on its own says almost nothing. The count of distinct keys does not cancel that way. Thirty one gatherings against a grid that expects 32 says a row is missing; 32 rows against 31 gatherings says a row is doubled. Both numbers are needed, and needed side by side, before either of them means anything at all.

ONE FILE, TWO CHECKS, TWO ANSWERS nothing about the file changes between the two; only what is being compared changes CHECK ONE, MATCH ON EVERY CELL the default in almost every tool 0 duplicate rows reported and the file is not clean CHECK TWO, MATCH ON STALL AND MONTH the key that has to be supplied 1 repeated key found NB-03, month 2 THE TWO COUNTS THAT MATTER rows in the file 32 distinct stall and month pairs 31 the gap, and the whole finding 1 WHY THE ROW COUNT LOOKS FINE eight stalls over four months expects 32 NB-03 month 2 is in twice, so add 1 NB-04 month 3 is absent, so take away 1 so the row count reads 32 A ROW COUNT ALONE HIDES TWO FAULTS PULLING OPPOSITE WAYS. THE KEY COUNT BESIDE IT DOES NOT.
Matching on every cell reports no duplicates while matching on the stall and the month reports one, and the row count reads a healthy 32 only because a doubled row and an absent row cancel each other out.
Try it out

A tool reports zero duplicate rows in this file. Is the file therefore free of duplicates?

Where does the key come from in the first place?

Everything above depends on having named the key correctly, so it is worth being exact about where a key comes from. A key comes from what one row is supposed to be about. The Neelbagh stall record was set up to hold one row for each trader for each month, and that sentence, written down before any data existed, is the key. The key appears in the column listThe written description of a file, saying what each column holds and what one row stands for. Whoever set the record up wrote it, and it is meant to be read before the data is. that came with the file, alongside the note that stall_id is the identifier and month runs 1 to 4.

A key is a decision somebody made about the shape of the record, and it is never something to go looking for in the data. The tempting move is the opposite one: sitting with the file, hunting for a column or a combination of columns that happens not to repeat, and calling that the key. Hunting for the key in the data feels rigorous. The move is exactly backwards, and this record shows why in one step.

Widening the existing key, stall and month, by adding filed_on_day makes NB-03's two rows differ inside the key itself, day 5 against day 19. Counted again, the gatherings come to 32 distinct keys over 32 rows. The gap closes. The tool reports a clean file. Nothing about the record has changed: the two forms are still sitting in the office, the market still traded eight stall months in month 2 and not nine. All that has changed is that the key was widened until the repeat could not be seen, and the reassuring number was read off the screen.

The same trap dresses up in other clothes. A column is unique today only because nobody has yet filed the second row that would repeat it. Two events rarely land on the same instant, so adding a timestamp to a key means almost nothing ever repeats. A record like that is not a record without duplicates. The key has been cut so fine that the question stopped being asked. The key comes from the written description of the record, it is fixed before anything is run, and the count then says what it says.

TWO OF THE EIGHT COLUMNS MAKE THE KEY, AND THE WRITTEN LIST SAYS WHICH the other six say what the answer was, and none of them helps decide what a row is about stall_id KEY stall_name licence_no category month KEY takings_rupees pitch_sqft filed_on_day the outlined column is the one somebody always wants to add, and here is what adding it does KEY: STALL AND MONTH 31 distinct keys over 32 rows one repeat found chosen before the file was opened KEY: STALL, MONTH AND FILING DAY 32 distinct keys over 32 rows nothing found at all chosen after the count disappointed THE SECOND KEY IS NOT BETTER. IT IS WIDE ENOUGH THAT THE QUESTION STOPPED BEING ASKED.
Widening the key with the filing day takes the file to 32 distinct keys over 32 rows and reports it clean, which shows that a key chosen to make the count tidy has settled nothing.
Try it out

Somebody suggests widening the key to stall, month and filed_on_day, since that separates NB-03's two rows and takes the duplicate count to zero. Is that a key?

What do five ways of settling one repeated row give?

The repeat has been found. The remaining decision is which figure the record is going to carry for NB-03 in month 2, and there are several defensible answers. Keep whichever return came in later, on the grounds that a revision replaces what it revises. Keep whichever came first, on the grounds that a record should carry what was originally reported. Keep the larger figure. Keep the smaller figure. Keep both rows and let the arithmetic take them both.

Any of those five is a rule somebody could argue for in a room. Which one is chosen matters less than when it is chosen. A rule for settling a repeat has to be written down before anybody looks at the two figures, because a rule chosen after they have been seen is not a rule at all, it is a preference wearing a rule's clothes. The rule is stated in words first, and then applied, and the arithmetic only ever comes afterwards.

Try it out

Five ways of settling one repeated row, applied to the same record. How many different published figures does that produce?

The five, worked against the cleaned record, appear below. The middle column is where the difference actually happens, so it matters as much as the right one: four of the rules change what goes into the total, and the fifth changes the divisor too.

The rule, stated firstWhat it makes the arithmeticWhat it publishes
Keep the later filingRs 15,71,700/- over 29 usable figuresRs 54,196.55/-
Keep the earlier filingRs 15,68,400/- over 29 usable figuresRs 54,082.76/-
Keep the larger figureRs 15,71,700/- over 29 usable figuresRs 54,196.55/-
Keep the smaller figureRs 15,68,400/- over 29 usable figuresRs 54,082.76/-
Keep both rowsRs 16,08,100/- over 30 usable figuresRs 53,603.33/-
Five rules, three answersRs 593.22/- apart end to end

Three answers from five rules, spread across Rs 593.22/- from the highest to the lowest. Every one of them is correct arithmetic on the record it was worked out from, under the same convention, with its divisor named beside it. There is no error anywhere in that table to find and put right. There is, instead, a decision somebody has to make and write down, and whoever reads the published figure will never see the two rows that produced it.

FIVE RULES, THREE ANSWERS, ONE RECORD colour marks the answer, so two rows in the same colour are two rules landing on one figure THE RULE THE ARITHMETIC IT MAKES WHAT IT PUBLISHES keep the later filing Rs 15,71,700/- over 29 Rs 54,196.55/- keep the earlier filing Rs 15,68,400/- over 29 Rs 54,082.76/- keep the larger figure Rs 15,71,700/- over 29 Rs 54,196.55/- keep the smaller figure Rs 15,68,400/- over 29 Rs 54,082.76/- keep both rows Rs 16,08,100/- over 30 Rs 53,603.33/- THREE COLOURS, NOT FIVE. AND ONLY THE LAST RULE CHANGES THE DIVISOR.
Five defensible rules for settling one repeated row publish only three different figures, and the rule that keeps both rows is the only one of the five that also changes the divisor.

Two of those rules agree, so does that confirm anything?

Look again at the table. Keep the later filing gives Rs 54,196.55/- over 29 usable figures. Keep the larger figure gives Rs 54,196.55/- over 29 usable figures. It is very tempting to read that as reassurance: two independent ways of settling the repeat, both arriving at the same place, so the figure must be sound.

The two rules agree because NB-03's revised return happened to be the larger of its two figures, and for no other reason. The stall reported Rs 36,400/- on day 5 and then corrected itself upward to Rs 39,700/- on day 19. The later filing and the larger figure are the same row in this record. They are not the same rule, and nothing forced them together.

Suppose the correction had gone the other way. Same two amounts, but the stall reports Rs 39,700/- first and then revises down to Rs 36,400/-, perhaps because a wholesale return was counted in by mistake. Keep the later filing now publishes Rs 54,082.76/- over 29 usable figures. Keep the larger figure still publishes Rs 54,196.55/- over 29. The two rules that seemed to confirm each other are now Rs 113.79/- apart, and nothing in the record would have warned that this was going to happen.

So one is never a check on the other. Two rules landing on one figure is a fact about the record in front of the analyst, not a fact about the rules. The household version is familiar enough: two people work out the shopping bill, one by adding the prices and one by counting the notes left in the purse, and they agree. The two routes share nothing, so agreement between them is a check. Two rules that both happen to point at the same row are not two routes. They are one route with two names on it.

TWO DIFFERENT RULES, AND WHETHER THEY MEET IS AN ACCIDENT OF THE RECORD AS THE RECORD STANDS, THE REVISION WAS UPWARD keep the later filing keep the larger figure the day 19 row Rs 54,196.55/- over 29 usable figures,and the two rules meet here IF THE SAME TWO AMOUNTS HAD ARRIVED THE OTHER WAY ROUND keep the later filing keep the larger figure the day 19 row the day 5 row Rs 54,082.76/- Rs 54,196.55/- both over 29 usable figures, and the two rules part company by Rs 113.79/- THE SAME TWO ANSWERS ON A WINDOW THREE HUNDRED RUPEES WIDE on a bar drawn from zero they would sit about one pixel apart, so the window is cut instead of the gap being flattered Rs 54,000/- Rs 54,300/- Rs 54,082.76/- Rs 54,196.55/-
Keep the later filing and keep the larger figure meet on this record only because the revision was upward, and they part by Rs 113.79/- the moment the same two amounts arrive in the other order.
Try it out

Keep the later filing and keep the larger figure both publish Rs 54,196.55/- over 29 usable figures. Does that confirm either of them?

Risk Management Program Bootcamp — Fin Maverick

What does keeping both rows quietly do?

Of the five rules, the one that does the most damage is the one that looks like doing nothing. Keep both rows, and no decision has been made, no evidence removed and nothing thrown away. The headline moves from Rs 54,196.55/- over 29 usable figures to Rs 53,603.33/- over 30, a difference of Rs 593.22/-. On a figure of about fifty four thousand rupees that is roughly one part in ninety. Nobody queries it. It looks like ordinary movement.

Meanwhile the divisor has gone from 29 to 30. Every figure the record produces for each row is now spreading itself over a stall month the market never traded. There were eight stalls trading in month 2 and the file now carries nine month 2 rows. The extra one is not a stall that closed, or a form that arrived late, or a pitch nobody took. The extra row is a filing counted twice and dressed up as an extra trader.

The count is the more serious half, and here is why. The total is out by Rs 36,400/-, a number somebody could notice. The divisor is out by one. Nobody checks a divisor, and it quietly reaches every figure computed for each row anywhere downstream: takings for each stall, takings for each square foot, the average printed beside every rule above. A total invites a query because people read totals. A divisor is written once at the bottom of a note and never looked at again.

THE DAMAGE IS DRAWN TWICE. THE SMALLER PICTURE IS THE ONE PEOPLE LOOK AT. ONE, WHAT IT DOES TO THE FIGURE a window one thousand rupees wide, because from zero these two would be about one pixel apart Rs 53,400/- Rs 53,650/- Rs 53,900/- Rs 54,150/- Rs 54,400/- Rs 53,603.33/- keeping both rows, over 30 Rs 54,196.55/- keeping the later filing, over 29 Rs 593.22/- apart TWO, WHAT IT DOES TO THE DIVISOR one square for each usable takings figure the arithmetic divides by 29 dark squares, one for each stall month the market really traded 1 red square, a filing counted twice and dressed up as a thirtieth stall month PEOPLE READ TOTALS AND QUERY THEM. NOBODY EVER READS THE DIVISOR.
Keeping both rows moves the published figure only Rs 593.22/- while it moves the divisor from 29 to 30, so the quieter of the two changes is the one that reaches every figure worked out for each row.
Try it out

Keeping both rows moves the headline only Rs 593.22/-. Why is that the dangerous option rather than the safe one?

Play with it

Move one control through five rules and watch three figures come out.

One thing moves: which rule settles NB-03's repeated month. The rest of the record is held exactly as the cleaning left it, so nothing else can be responsible for the result. Beside the slider sit two buttons that are no part of it. One jumps straight to a rule without dragging through the others, and one turns the record round so that the same two amounts arrive in the opposite order. The panel opens on keep the later filing, publishing Rs 54,196.55/- over 29 usable figures, the reading printed in the table above.

Jump to a rule, or turn the record round:
What this rule publishes
Rs 54,196.55/-
over 29 usable figures
What it keeps
the day 19 row
Rs 39,700/-
Against the published reading
the same figure
keeping the later filing, over 29

Educational illustration. Three simplifications are worth naming. The rest of the record is frozen while the rule moves, where a working office would be changing several things at once. Only two forms ever arrive for this month, where a stall could file three times. And turning the record round swaps which day carries which amount and changes nothing else, so the two rules come apart cleanly enough to see.

Derivatives Foundation Bootcamp — Fin Maverick

What is the second kind of duplicate in this record?

There is a duplicate in the Neelbagh stall record that has nothing to do with rows. Group by the stall_name column and count the gatherings: nine. Group by stall_id and count again: eight. One of those is a count of stalls in this market. The other is a count of ways somebody spelled a stall name.

Months 1 and 2 carry Harit Greens against NB-03. Months 3 and 4 carry Harit Green. Somewhere between the second and third month, whoever was typing at the desk dropped a letter, or a different clerk took over, or a form arrived with it written that way. One trader has become two entries, and both counts above are perfectly correct arithmetic. Only one of them is answering the question intended.

Join on the identifierA code issued once and then reused, like a licence number or a stall code. Nobody types it fresh each time, which is the whole reason it can be trusted., never on the name. An identifier is issued once, by somebody whose job it is, and afterwards it gets copied rather than composed. A name gets typed by whoever is on the desk that morning, and typing is where variation comes from: a space, a plural, a full stop, an initial, a title. Every one of those turns one thing into two, silently, in a column that still looks perfectly tidy on the screen.

Typing is also the reason the identifier column exists at all. The column is not decoration, and not a serial number for the office's convenience. The identifier is the one column in the record that a human hand is not free to vary, and that is precisely what makes it safe to joinLine two records up so that rows about the same thing sit together. Doing it in code, and everything that can go wrong along the way, is covered separately under programming for finance. on. Actually lining two records up against each other, and the several ways that goes wrong, is covered separately under programming for finance.

ONE FILE GROUPED TWO WAYS, AND THE MARKET CHANGES SIZE nothing was added or removed between the two columns below GROUPED BY STALL_NAME GROUPED BY STALL_ID Kadamba Idli Chandan Tea Harit Greens months 1 and 2 Harit Green months 3 and 4 Peetal Utensils Bansi Flour Ilaka Fruit Sundari Chaat with Peeli Mithai as the ninth NB-01 NB-02 NB-03 all four months, however it was spelled NB-04 NB-05 NB-06 NB-07 with NB-08 as the eighth 9 names, and one of them is a typing slip 8 identifiers, and this is the count of stalls BOTH COUNTS ARE CORRECT ARITHMETIC. ONLY ONE OF THEM IS A COUNT OF TRADERS.
Grouped by name this file holds nine stalls and grouped by identifier it holds eight, because one trader is written two ways and only the identifier column is safe from a hand at a keyboard.
Try it out

Grouped by name this file holds nine stalls and grouped by identifier it holds eight. What follows from that?

Bond Pricing and Yield Mechanics — free micro-course from Fin Maverick

What has to happen before any row comes out?

All of this collapses into four small habits, and none of them requires a tool beyond what is already at hand. The key is written down before the file is opened, rows are counted against distinct keys with both numbers recorded, the rule for settling a repeat is stated in words before the figures are looked at, and whatever is removed is kept.

The first three follow from everything above. The fourth deserves its own sentence. The commonest reason to want a removed row back is not regret about the rule. The commonest reason is discovering that the key was wrong. Somebody realises the record actually holds one row for each stall for each month for each category, or that a stall can trade two pitches, and now the rows deleted as repeats were never repeats at all. Kept in a small separate file with a note saying which rule removed them, they are an afternoon of work. Not kept, they are a phone call to a market office asking whether anybody still has last quarter's forms.

The habit reads differently for each of the people who actually meet the fault. A lender comparing two small traders is looking at a takings figure with a divisor underneath it, and the first question worth asking is how many months that divisor counts and whether any of them is in there twice. An analyst handed a file of monthly numbers should count rows and distinct keys before doing anything else. The comparison is cheap, and it catches both a doubled row and a missing one. And a household keeping its own accounts, working out what it spends each month, is doing exactly the same arithmetic with a shoebox of bills: the divisor is how many months there actually are, not how many pieces of paper are in the box.

FOUR THINGS TO DO BEFORE ANY ROW COMES OUT, IN THIS ORDER 1 WRITE THE KEY take it from the written column list, not from hunting in the data 2 COUNT TWICE rows, then distinct keys, and write both numbers down side by side 3 STATE THE RULE in words, and before anybody has looked at either of the figures 4 KEEP WHAT IS REMOVED because the usual reason to want it back is a key that turned out wrong THE ROWS TAKEN OUT NB-03, month 2, Rs 36,400/- removed under: keep the later filing Steps two and three cost about four minutes between them on a file this size. Step four costs nothing at all until the day it saves an afternoon.
The key is written down, rows are counted against distinct keys, the settling rule is stated in words before the figures are seen, and removed rows are kept in a small separate file that names the rule.

What goes wrong when nobody counts twice

The market office builds its month 2 summary straight from the file as it stands. NB-03's two forms are both in, so month 2 shows nine rows for the eight stalls that traded, and the takings for each stall month is worked out over 30 usable figures rather than 29. The month 2 total carries Rs 36,400/- that no trader took, and the published figure reads Rs 53,603.33/- where the record settled under a stated rule gives Rs 54,196.55/- over 29 usable figures, a difference of Rs 593.22/-.

Nothing looks wrong. Every row in that summary is a real filing. Every figure was typed correctly. The addition and the division are both right, and anybody rechecking the arithmetic will find it perfect. The office has published a market with a stall month in it that never happened, and the only thing that would have caught it is a comparison nobody ran. Count the rows, count the distinct keys, and if the two disagree, settle it before anything is added up.

The cleaning run as a whole, the counts run across a file to profile it, and the discipline of stating rules in advance are set out separately and carry forward into the repeated key. Lining two separate records up against each other, and the several ways that goes wrong, is covered separately under programming for finance. Settling a repeated key needs an average and its divisor and nothing else. Probability, a spread, a fitted line and measurement across time all sit outside the problem, and the divisor is named beside every printing of the average above. Two rows answering one question is the same problem in every market anybody keeps a record of, so no rate, threshold, filing period or published rule enters it.
A stall month that never happened reached the market. See what a duplicate costs.

Where did the figures above come from, and how can any of them be settled independently?

Where each claim above comes fromWhether it existsHow a reader settles it
The 32 rows of the Neelbagh stall recordWritten for teaching, with the faults built in deliberatelyMonth 2 is printed whole above. The other three months are printed whole where this record was first introduced.
The two counts, 32 rows against 31 distinct stall and month pairsCounted off those rowsCount them. Nine rows in month 2 for eight stalls is the entire discrepancy.
The three published answers and the two gaps between themOne addition and one division for each rule, worked hereAdd the takings column under each rule, divide by how many cells went in, and subtract one answer from another.
The two spellings of NB-03Written for teaching as a slip at a deskCompare the name column against the identifier column across the four months.
Any rate, threshold, filing period or published ruleNone is usedNothing to settle. Two rows answering one question is the same problem whatever the rates.

The Neelbagh market, the Neelbagh stall record, the market office and the stalls NB-01 Kadamba Idli, NB-02 Chandan Tea, NB-03 Harit Greens, NB-04 Peetal Utensils, NB-05 Bansi Flour, NB-06 Ilaka Fruit, NB-07 Sundari Chaat and NB-08 Peeli Mithai are invented.
Educational material. Not advice on any investment, tax, budget or market position.

← PreviousNext →
Fin Maverick Micro CoursesExplore Micro Courses
Fin Maverick BootcampsExplore Bootcamps
Fin Maverick

Finance education that ends in a job, not a certificate that gathers dust. Built for young India.

LEARN
CalculatorsFrameworksComparisonsCareersShowdown
RESOURCES
All CoursesMicro CoursesBootcampsInternships
COMPANY
AboutJob openingPartnership
LEGAL
Privacy PolicyTerms & ConditionsContent LicenseReturn & Refund Policy
© 2026 FIN MAVERICK / BUILT FOR INDIA.DO FINANCE, DO NOT JUST READ ABOUT IT.