Most advice on learning Python is written for people who want to become software engineers. An analyst on a deal team wants something narrower: to stop doing the same data work by hand every time a peer set changes or a data room is refreshed. That takes a small, specific part of the language, and it can be learned in weeks beside a full-time job. This guide sets out which part, works a comps table from raw figures to a value per share, and names the checks that stop a script from being quietly wrong.
Where Python earns its place, and where Excel stays
The model that goes to a client stays in Excel. A managing director, a client and the other side of the deal can all open a workbook, trace a cell and change an assumption. Nothing about Python changes that, and an analyst who rebuilds an operating model in code has produced something nobody senior can review.
Python earns its place one step earlier, in the work that feeds the model. That work is repetitive, it is done under time pressure, and an error in it is hard to see because nobody reads four thousand rows.
- Refreshing a comps table when the peer set, the period or the prices change
- Cleaning a data-room export: a customer list with 40,000 rows, three date formats and duplicated accounts
- Screening: every listed company in a sector above a size threshold, with the same five ratios for each
- Joining two sources that disagree about names, such as a customer file and a revenue file
- Producing the same twelve charts for every company in a pitch
The part of the language worth learning
One library does most of the work. pandas holds a table in memory as a DataFrame, which behaves like a worksheet whose columns have names instead of letters. If you can filter, add a calculated column, group, join and write the result back to Excel, you can do nearly everything on the list above.
Learn it in the order you would use it. Skip the rest until a task forces it: web frameworks, classes, machine learning and anything described as a design pattern are other people’s jobs.
| Step | In pandas | Replaces |
|---|---|---|
| Read a file | read_excel, read_csv | Opening the export and copying a range |
| Filter rows | df[df["revenue"] > 500] | An AutoFilter |
| Add a column | df["margin"] = df["ebitda"] / df["revenue"] | A formula filled down |
| Summarise | groupby, median, describe | A pivot table |
| Join two tables | merge | INDEX and MATCH across sheets |
| Write it back | to_excel | Paste special, values |
A worked example: a comps table in ten lines
Take five listed peers, with enterprise value and last-twelve-month EBITDA in millions. The task is the one every analyst knows: the multiple for each, the median, and what the median implies for a target with EBITDA of 250, net debt of 600 and 95 million diluted shares.
Three lines do the work. The first adds the multiple as a column, the second takes its median, and the third applies the median to the target.
The median is 10.0x and the mean is 10.1x. At the median the target is worth 250 x 10.0 = 2,500 of enterprise value. Subtract net debt of 600 and the equity is worth 1,900, which over 95 million shares is 20.00 a share. Each of those figures is one you could have reached in Excel, which is the point: the script is the same arithmetic, written once.
The gain arrives on the second run. When the peer set changes, or prices move, or the team wants the same table on next-twelve-month figures, the input file changes and the ten lines do not.
- comps["ev_ebitda"] = comps["ev"] / comps["ebitda"]
- multiple = comps["ev_ebitda"].median()
- value_per_share = (250 * multiple - 600) / 95
| Company | Enterprise value | LTM EBITDA | EV / EBITDA |
|---|---|---|---|
| A | 4,200 | 420 | 10.0x |
| B | 2,880 | 320 | 9.0x |
| C | 6,050 | 550 | 11.0x |
| D | 1,500 | 200 | 7.5x |
| E | 3,900 | 300 | 13.0x |
| Median | 10.0x |
The error a script makes that a spreadsheet does not
A spreadsheet shows you every row, so a doubled figure tends to be seen. A script shows you only what you ask for, and its most common failure is silent: a join that multiplies rows.
Suppose the five peers above are joined to a second table of segment data that carries two rows for each company. The result has ten rows, not five, and every company’s enterprise value now appears twice. Sum the column and the peer set is worth 37,060 rather than 18,530. Nothing errors. The median multiple is unchanged, so the first check you would think to make passes, and the mistake surfaces only when someone totals the column in a footnote.
The remedy is a habit, not a tool. Count the rows before and after every join, and tie one total back to the source file. Units deserve the same suspicion: an export in thousands joined to a table in millions produces a multiple that is wrong by a factor of a thousand, and a comps table with one peer at 0.01x has been seen in more than one draft.
- Row count before and after every merge
- One total tied back to the source, by hand, on every run
- Units stated in the column name: ev_m, revenue_k
- The input file kept unchanged, so the run can be repeated
A second use: the arithmetic you already do in your head
Python is also a calculator that keeps its working. A multiple of invested capital of 2.5x over five years is an internal rate of return of 2.5 ** (1 / 5) - 1, which is 20.1%. The paper LBO answer of roughly 20% is that sum, rounded.
Used this way it is a checking tool. When a model reports an IRR, one line confirms whether the number is plausible before anyone asks.
How to talk about it on a CV and in an interview
Name the task and the result, not the language. "Rebuilt the weekly comps refresh for a 14-company peer set in pandas, cutting it from two hours to a few minutes" is a line an interviewer can ask about. "Proficient in Python" is a line they skip.
Postings differ on whether they ask for it, and the posting is the evidence: read what the employer wrote rather than assuming. Where a role lists Python as desirable, expect a conversation about what you have built, not a coding test. Technical rounds in banking remain accounting, valuation and deal mechanics, and no amount of pandas offsets a weak answer on enterprise value.
A four-week plan beside a full-time job
Four weeks at three or four hours a week is enough to be useful, provided every session uses your own data rather than a tutorial’s.
- Week 1: install Python and a notebook, read one of your own exports, filter it and add two calculated columns
- Week 2: group and summarise, then rebuild a pivot table you already maintain and tie the totals
- Week 3: join two files, count rows before and after, and write the result back to a formatted workbook
- Week 4: turn the comps refresh above into a script that runs from the input file to the output with no manual step
Next
See the method run on a real company
The research skills are written-up workflows for the tasks in this guide: an earnings review, a comps set, a filing comparison. Each one states its sources and shows its working.
Keep your Comps Explorer results
Comps Explorer is free without an account. A free account keeps your practice streak and the drills you have done on every device, and builds the next three things to do from your target. One email, no password.
Technology for finance: learn it, then use it
Python, SQL, version control and AI tools, used the way an analyst uses them: on data, with the checks.
Frequently asked questions
Do investment bankers need to know Python?
No. The job is done in Excel and PowerPoint, and interviews test accounting, valuation and deal mechanics. Python is useful for the repetitive data work around a model, such as refreshing comps or cleaning a data-room export, and it is worth learning once the core technical skills are secure.
Should I learn VBA or Python?
Python, for most analysts starting today. VBA automates Excel itself and still matters where a team maintains old macros, but pandas handles large files, joins and repeatable analysis more cleanly, and the skill carries to data and buy-side roles.
How long does it take to become useful?
About a month at three or four hours a week, if you practise on your own files. The target is narrow: read a file, filter it, add columns, group, join and write the result back to Excel.
Can I build a financial model in Python instead of Excel?
You can, and for a model other people must review you should not. A workbook can be opened, traced and changed by a client or a senior banker. Use Python for the data that feeds the model and keep the model itself in Excel.
