Public report of pandas-dev/pandas, published 14 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 14 November 2026, 18:28 UTC · Survey ID cd_978bcfcff34942a8a23e23c9612e6a08
pandas-dev/pandas
Measured 14 November 2026, 18:26 UTC, at code version ac3e45f
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Up 2 since the last survey
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 250,858 lines of product code in 1 project, tests not counted · Estimated rebuild effort: about 5.3 person-years · Weakest lens: Accessibility, 59
Findings by how serious they are
23 critical1887 serious76 minor
20 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 18:26 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
52of 52 dimensions measured by tools.
1973of 1986 findings point to an exact file and line, so you can open each one in the code. The other 13 concern the repository as a whole, such as missing documentation.
52dimensions across 7 lenses, read from 250,858 lines of product code in 1 project.
pandas-dev/pandas falls short of our standard for production because it has pages that don't say their language. It scores 67 out of 100 and is rated Adequate, and 13 of its 23 critical findings are security problems.
Accessibility, at 59, is the weakest lens and counts most in the score. The best first step is fixing focus, motion and contrast, worth about 6 points. Structuring the pages comes next, worth about 4 points. Raising Accessibility to 70 would lift the score to about 72.
Eight pipeline steps install packages that can change without warning. Three pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with, and eight buttons or links have no name a screen reader can say. Pinning what the pipeline installs, pinning each tool to an exact version and naming the buttons and links would close these risks. The password or key in the code's history needs replacing, with the old one switched off. The place where the code runs text as code or as a command needs a direct call instead. The two pages that don't say their language need their language set.
The product code is 250,858 lines, about €780,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Accessibility rose from 59 to 70, the lowest score rated Strong, the score would rise from 67 to about 72.
Code composition: what the lines of code are
Product code 40%Tests 60%
New since the last survey: 163 findings
These 163 critical or serious findings weren't in the previous survey, on 27 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · FileTooLong: sql/base.py pandas/io/sql/base.py
Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) pandas/core/frame.py
Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) pandas/core/arrays/arrow/array.py
Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) pandas/core/groupby/generic.py
Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) pandas/core/internals/blocks.py
Code Duplication · Edited copy of a member (62 corresponding lines) pandas/core/arrays/datetimelike.py
Code Duplication · Edited copy of a member (58 corresponding lines) pandas/tseries/frequencies.py
Code Duplication · Edited copy of a member (70 corresponding lines) pandas/core/window/numba_.py
Code Duplication · Edited copies of one member (3 members, 86+ corresponding lines) pandas/core/_numba/kernels/mean_.py
Code Duplication · Edited copy of a member (93 corresponding lines) pandas/core/generic.py
Code Duplication · Edited copy of a member (52 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (121 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (49 corresponding lines) pandas/core/nanops.py
Code Duplication · Edited copy of a member (73 corresponding lines) pandas/core/indexes/base.py
Code Duplication · Edited copy of a member (49 corresponding lines) pandas/core/groupby/numba_.py
Code Duplication · Edited copy of a member (95 corresponding lines) pandas/core/frame.py
Code Duplication · Edited copies of one member (4 members, 32+ corresponding lines) pandas/core/window/ewm.py
Code Duplication · Edited copy of a member (82 corresponding lines) pandas/core/window/ewm.py
Code Duplication · Edited copy of a member (37 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (31 corresponding lines) pandas/core/indexes/multi.py
Code Duplication · Edited copy of a member (49 corresponding lines) pandas/core/window/numba_.py
Code Duplication · Edited copy of a member (27 corresponding lines) pandas/core/arrays/timedeltas.py
Code Duplication · Edited copy of a member (37 corresponding lines) pandas/core/groupby/groupby.py
Code Duplication · Edited copy of a member (50 corresponding lines) pandas/core/indexes/datetimes.py
Code Duplication · Edited copy of a member (80 corresponding lines) pandas/core/arrays/masked.py
Code Duplication · Edited copy of a member (27 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (66 corresponding lines) pandas/core/groupby/groupby.py
Code Duplication · Edited copy of a member (134 corresponding lines) pandas/io/pytables.py
Code Duplication · Edited copy of a member (21 corresponding lines) pandas/core/indexes/datetimes.py
Code Duplication · Edited copy of a member (17 corresponding lines) pandas/core/indexes/accessors.py
Code Duplication · Edited copy of a member (46 corresponding lines) pandas/core/arrays/sparse/array.py
Code Duplication · Edited copy of a member (12 corresponding lines) pandas/core/arrays/_arrow_string_mixins.py
Code Duplication · Edited copy of a member (50 corresponding lines) pandas/core/arrays/_mixins.py
Code Duplication · Edited copy of a member (23 corresponding lines) pandas/core/apply.py
Code Duplication · Edited copy of a member (30 corresponding lines) pandas/core/arrays/categorical.py
Code Duplication · Edited copy of a member (13 corresponding lines) pandas/core/indexes/interval.py
Code Duplication · Edited copy of a member (29 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (25 corresponding lines) pandas/core/arrays/base.py
Code Duplication · Edited copies of one member (3 members, 17+ corresponding lines) pandas/io/clipboard/__init__.py
Code Duplication · Edited copy of a member (28 corresponding lines) pandas/io/sql/sqla.py
Code Duplication · Edited copy of a member (39 corresponding lines) pandas/io/sql/sqla.py
Code Duplication · Edited copy of a member (43 corresponding lines) pandas/core/series.py
Code Duplication · Edited copy of a member (19 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (33 corresponding lines) pandas/io/stata.py
Code Duplication · Edited copy of a member (16 corresponding lines) pandas/io/formats/format.py
Code Duplication · Edited copy of a member (17 corresponding lines) pandas/core/apply.py
Code Duplication · Edited copy of a member (22 corresponding lines) pandas/core/apply.py
Code Duplication · Edited copy of a member (23 corresponding lines) pandas/core/_numba/kernels/mean_.py
Code Duplication · Edited copy of a member (69 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (15 corresponding lines) pandas/core/arrays/timedeltas.py
Code Duplication · Edited copy of a member (151 corresponding lines) pandas/core/generic.py
Code Duplication · Edited copy of a member (18 corresponding lines) pandas/core/nanops.py
Code Duplication · Edited copies of one member (3 members, 111+ corresponding lines) pandas/core/groupby/groupby.py
Code Duplication · Edited copy of a member (9 corresponding lines) pandas/core/arrays/arrow/array.py
Code Duplication · Edited copy of a member (29 corresponding lines) pandas/io/parquet.py
Code Duplication · Edited copy of a member (21 corresponding lines) REDACTED
Code Duplication · Edited copy of a member (25 corresponding lines) pandas/core/arrays/datetimelike.py
Code Duplication · Edited copy of a member (9 corresponding lines) pandas/io/stata.py
Code Duplication · Edited copies of one member (3 members, 97+ corresponding lines) pandas/core/groupby/groupby.py
Code Duplication · Edited copies of one member (4 members, 15+ corresponding lines) pandas/core/window/rolling.py
Code Duplication · Edited copy of a member (60 corresponding lines) pandas/core/frame.py
Code Duplication · Edited copy of a member (70 corresponding lines) pandas/core/frame.py
Code Duplication · Edited copy of a member (47 corresponding lines) pandas/core/nanops.py
Code Duplication · Edited copy of a member (10 corresponding lines) pandas/io/stata.py
Code Duplication · Edited copy of a member (8 corresponding lines) pandas/core/arrays/arrow/array.py
Code Duplication · Edited copy of a member (9 corresponding lines) pandas/core/arrays/arrow/array.py
Code Duplication · Edited copy of a member (15 corresponding lines) pandas/core/arrays/interval.py
Code Duplication · Edited copy of a member (11 corresponding lines) pandas/io/pytables.py
Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) pandas/core/array_algos/masked_reductions.py
Code Duplication · Edited copy of a member (9 corresponding lines) pandas/core/generic.py
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 50 findings
These 50 critical or serious findings were in the previous survey, on 27 October 2026, and are gone from this one.
A11y enforcement · Accessibility enforcement below the top rung
Rebuild cost: about €780,000 · Estimate
Cost to rebuild
€260,000 to €1,300,000, for 4,302 to 13,646 hours of work, about 5.3 person-years for 3 to 11 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.9 at a score of 67. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 250,858 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Raises the score by about 4 points · Medium effort · Page structure
3
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Raises the score by about 4 points · Medium effort · Forms & labels
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €780,000 to build again, about 5.3 person-years of work. Its weakest lens is Accessibility, at 59 (Adequate). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1. Of all the actions in this report, it raises the score most for the work it takes: about 6 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.3 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 4% to 10% on every change. The history of the code shows how much it changes: about 324,191 lines over the last 90 days, which is about 1,314,775 lines a year. At that pace, the extra work comes to an estimated 141.7 to 850.4 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
At a glance — Code Health · 74% · Adequate · gated by D2 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
32
High / Critical
A03:2025 — Software Supply Chain Failures
5
Medium
A07:2025 — Authentication Failures
2
High / Critical
Roadmap
Top priorities: Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1; Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh; Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 23
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 1887
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 76
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 20
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 52 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 52 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1973 of 1986 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT READ here — but this repository measures it: a Codecov configuration (codecov.yml) and a coverage step in CI (`codecov/codecov-action`) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.py), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.py) and this repository declares a Python test suite (repository root, 995 test files), but it was not re-run: its dependency install failed (pip exit 1: no error line printed), so its suite was not run against dependencies it does not declare. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D12 Dependency Hygiene — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. This repository's 3 shipped Python distribution(s) across 2 manifest(s) WERE read; what went unanswered is the currency half, because it grades an EXACT pin against the newest release and every declaration here is a floor or a range — which installs the newest release it admits and so cannot be behind one. So pypi.org was never asked. This is a true statement about the repository, and the healthy one, NOT a gap on our side: no reader we could write would find a currency question here.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D26 Project Cohesion — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `(repository root)` (250858 LoC, 1211 module-visible types across 55 directories) is over its size bounds, and whether one unit is a coherent whole or a grab-bag is read from its type references: the parts of it that reach the rest only through its shared core. Those are read over the C#/VB code model, which this unit's source did not supply. Its size alone is no verdict on its cohesion, so none is published.
AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
AXB1 Runtime evidence locked — no reproducible boot — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Subject: 5 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'pandas.io.sql' is imported (pandas/io/api.py:51), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'pandas.io.sql' is imported (pandas/io/api.py:51), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'pandas.io.sql' is imported (pandas/io/api.py:51), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python, c, cpp is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python, c, cpp is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
P8 Schema migrations — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. The schema may be created by a runner, a deploy script or a config file outside what this check reads, so an absence here is our blind spot rather than a missing migration strategy. The card abstains instead of scoring. You can widen what we reach: if the schema is created and evolved by a tool this check does not name, naming it lets us teach the detector to read it.
X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 10 further occurrence(s) are not listed individually; the score already reflects all 50.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript (Vue and Svelte components included), Java, Rust, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's C, Cpp, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
+ 247 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with readers._read_csv_chunks (cyclomatic 70), cast.np_can_hold_element (cyclomatic 68), _MergeOperation._maybe_coerce_merge_keys (cyclomatic 65). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cyclomatic Complexity from 5.6 to about 5.9/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 483 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 32 bodies over 60 down to 60 or less in Cognitive Complexity — start with cast.np_can_hold_element (cognitive 172), MultiIndex._get_locs (cognitive 133), MultiIndex._get_loc_level (cognitive 116). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 32 together lifts Cognitive Complexity from 2.0 to about 3.8/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.6 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 63 FileTooLong finding(s) in God Classes — start with base.py (4), datetimes.py (3), generic.py (2). — One of this dimension's main actionable groups (63 warning-level).
Resolve the 36 TooManyMethods finding(s) in God Classes — start with base.py (2), array.py (2), datetimelike.py (2). — One of this dimension's main actionable groups (36 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
88 duplicated block group(s) detected. 4.3 % of the production lines (10,693 of 250,858) are in a reported copy. A further 106 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 1 of the 194 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 118 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6 Duplicated block (13 lines × 2) finding(s) in Code Duplication — start with masked.py, blocks.py, ewm.py. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 6 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with datetimelike.py, interval.py, generic.py. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 6 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with categorical.py, range.py, _openpyxl.py. — One of this dimension's main actionable groups (6 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 12 Low cohesion finding(s) in Cohesion (LCOM4) — start with base.py (2), frame.py, series.py. — One of this dimension's main actionable groups (12 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the code respects its intended layering / architecture rules.
Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.
No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 3 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 3 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (0 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. This repository publishes itself under BSD-3-Clause, which is its own choice and is not judged here.
What it measures: Files that change often and are also complex — the riskiest hotspots.
Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.
Top hotspots: pandas/core/frame.py (76×35=2660); pandas/io/parsers/readers.py (32×70=2240); pandas/core/generic.py (47×46=2162) Repeated repair below the complexity floor: REDACTED (10 of 11 changes were fixes); pandas/io/sas/sas7bdat.py (8 of 10 changes were fixes); pandas/plotting/_matplotlib/timeseries.py (8 of 9 changes were fixes)
Resolve the 49 Hotspot finding(s) in Churn × Complexity Hotspots — start with generic.py (2), array.py (2), pytables.py (2). — One of this dimension's main actionable groups (49 warning-level).
Resolve the 11 Repeated repair finding(s) in Churn × Complexity Hotspots — start with REDACTED, sas7bdat.py, timeseries.py. — One of this dimension's main actionable groups (11 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.1 / 10Exemplary✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
26 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is pandas/io/clipboard/__init__.py. Counted over 286 of the 386 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Off-boarding risk: anonymized user #1 · ×2
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
728 deducted task-comment markers across 250858 LoC (0.3/KLoC) → score 9.4. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
Resolve the 710 TodoComment finding(s) in Explicit Debt — start with core.py (26), managers.py (24), array.py (23). — One of this dimension's main actionable groups (710 warning-level).
Resolve the 8 HackComment finding(s) in Explicit Debt — start with test_sql.py (2), test_get_dummies.py, test_coercion.py. — One of this dimension's main actionable groups (8 warning-level).
Resolve the 8 FixmeComment finding(s) in Explicit Debt — start with test_constructors.py (3), multi.py (2), test_orc.py. — One of this dimension's main actionable groups (8 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
0 of 11 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question, a date that is no calendar day). How well each record argues its case is not measured.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
1 naming inconsistencies among 28 declarations measured against a convention their peers follow.
`ReadCsvBuffer` spells `Csv` where 27 names in the project spell it `CSV`pandas/_typing.py:315
What to do
Resolve the 1 `ReadCsvBuffer` spells `Csv` where 27 names in the project spell it… finding(s) in Naming Consistency — start with _typing.py. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
100 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
32 finding(s): 0 critical, 12 high, 19 medium, 1 low. semgrep hit a parse error in 11 file(s) — `doc/_templates/docs-announcement-banner.html` (line 1), `pandas/_libs/include/pandas/vendored/klib/khash.h` (line 300, line 302, lines 303–304, …), `pandas/_libs/include/pandas/vendored/ujson/lib/ultrajson.h` (line 294, line 325, line 327), `pandas/_libs/src/datetime/pd_datetime.c` (line 344, line 346), `pandas/_libs/src/parser/pd_parser.c` (line 144, line 146), … (+6 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 6 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 8 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (6), REDACTED (2). — One of this dimension's main actionable groups (8 issue-level).
Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 1 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
19 of 286 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is pandas/core/_numba/extensions.py. Counted over 286 of the 386 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 0 platform declaration(s) and 3 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.
Do you agree with this assessment?
AC2 · Forms & labels5.1 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label. (×8) — REDACTED:68, REDACTED:73, REDACTED:78, …
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Do you agree with this assessment?
AC3 · Page structure5.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). (×2) — pandas/io/formats/templates/html.tpl:4, REDACTED:2
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — pandas/io/formats/templates/html.tpl:4
Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. — REDACTED:19
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`blockquote` sets color: #787878 on background-color: #f9f9f9 — 4.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/pandas/static/css/pandas.css:113
`.gs-data .badge` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — doc/source/_static/css/getting_started.css:32
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Most of the production code is in directories of its own, but 2 application file(s) sit at the repository root beside the build and tooling files (`generate_pxi.py`, `generate_version.py`).
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability7.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
`.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — .github/dependabot.yml:2
What to do
Dependabot is configured but does not watch `pip` — add that `package-ecosystem` entry to .github/dependabot.yml so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.
Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.
No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
What to do
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Other · Security — Only what this repository's own non-C# files could be read for was assessed — markup this repository SHIPS is scored for third-party script integrity whether or not the repository serves it itself, since a page handed to a consumer runs in that consumer’s origin. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
`https://views.scientific-python.org/js/script.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository. — REDACTED:4
What to do
Pin third-party scripts and verify them: name an exact version in the URL and add an `integrity="sha384-…"` hash alongside `crossorigin="anonymous"` (both are required — an integrity hash on a cross-origin script without `crossorigin` is not evaluated, it blocks the script). Where the vendor ships a continuously-updated loader and publishes no stable hash (tag managers, analytics, chat widgets), Subresource Integrity is not available: constrain it instead with a `Content-Security-Policy` that names the exact origins allowed to execute, and drop the script from the pages that do not need it. Where the page is shipped inside a package that others host, prefer vendoring the asset and serving it from the app’s own origin, so no consumer inherits a third-party dependency they did not choose.
Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.
Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.
Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X17 · Uncapped recursion over a caller-supplied document2.0 / 10Critical✓ Tool-verified
Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.
Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.
`get_callable_name` is public and takes `obj: object` from its caller, and it calls itself at line 382 (`get_callable_name`) with a piece of `obj` — and nowhere in `get_callable_name` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `get_callable_name` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pandas/core/common.py:382
`infer_dtype_from_scalar` is public and takes `val: object` from its caller, and it calls itself at line 784 (`infer_dtype_from_scalar`) with a piece of `val` — and nowhere in `infer_dtype_from_scalar` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `infer_dtype_from_scalar` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pandas/core/dtypes/cast.py:784
`np_can_hold_element` is public and takes `element: Any` from its caller, and it calls itself at line 1823 (`np_can_hold_element`) with a piece of `element` — and nowhere in `np_can_hold_element` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `np_can_hold_element` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pandas/core/dtypes/cast.py:1823
`shares_memory` is public and takes `left: Any` from its caller, and it calls itself at line 536 (`shares_memory`) with a piece of `left` (and at line 539, line 540, line 543, line 545, line 547, line 564, line 567, line 571) — and nowhere in `shares_memory` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `shares_memory` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — pandas/_testing/__init__.py:536
What to do
Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.
Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.
Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×3) — pandas/plotting/_matplotlib/converter.py:399, pandas/plotting/_matplotlib/core.py:1864, pandas/io/json/_json.py:1758
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×7) — pandas/plotting/_matplotlib/converter.py:423, pandas/plotting/_matplotlib/converter.py:541, pandas/io/_util.py:400, …
What to do
Swallowed exception (caught, then discarded)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 3 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: this repository stores data through 'pandas.io.sql' (pandas/io/api.py:51) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and MongoEngine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether its changes need an audit trail could not be established, and the trail's absence is not scored.
C4 Data Retention — Not assessed: this repository stores data through 'pandas.io.sql' (pandas/io/api.py:51) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, SQL schemas). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
C5 Data-Subject Rights — Not assessed: this repository stores data through 'pandas.io.sql' (pandas/io/api.py:51) but declares no persisted model this check reads (Django, SQLAlchemy, SQLModel, Peewee, Tortoise and mongoengine model fields, Alembic and Django migration columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 58 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AX1 Captive dependencies — Not applicable: this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads.
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — No access-control surface detected in the analyzed source — this repository registers no route and starts no server another machine can reach (no Flask/FastAPI/Starlette route, Django urlpatterns or class-based view, Tornado handler). Access control is therefore N/A here — a library or command-line tool is authorized by the application that serves it, not by itself. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
D10 Test Quality — ~383908 lines of test source are present (.py) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
D11 Test Reliability — Test reliability not included — the .py suite was found but not re-run
D12 Dependency Hygiene — Dependency currency not established — no declaration carries an exact pin to grade
D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .py, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — None of 8 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
D26 Project Cohesion — D26 could not read how the parts of this repository's one build unit reference each other, so its cohesion was not measured. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Not applicable — this Python build ships 1 production module(s), so there is no coupling BETWEEN modules to measure. (Its test and non-production modules are not part of the shipped graph.)
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (7 value object(s))
ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
M4 Documentation accuracy — Not applicable: the 200 current-state document(s) make no claim of a kind M4 checks. 25 claim(s) of kinds M4 does not check were not checked (path 15, command argument 2, environment variable 8); M4 checks only links and versions and artefact counts.
P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python source, so there is no service whose uptime a failing dependency could take down
P8 Schema migrations — SQLAlchemy is declared, but the schema-migration mechanism could not be identified. Our limit, not a verdict on this repository.
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
PF3 Async & latency hygiene — Not applicable: this repository declares no async functions, so there is no asynchronous code for a blocking call to stall.
X1 Async correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X2 Cancellation propagation — no C# was loaded; this repository's Python was read, and no request in it can be cancelled by a caller — a Python request takes no token: asyncio cancels the task and trio or anyio the scope that made it, from outside the call, and requests, httpx, aiohttp and gRPC take a timeout, not a cancellation
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
Critical — 23 finding(s)
AC2 · Forms & labels· Link with no accessible name · ×8
Link with no accessible name REDACTED:68— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:73— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:78— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:83— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:88— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:76— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:81— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
Link with no accessible name REDACTED:86— A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label.
<html> without a lang pandas/io/formats/templates/html.tpl:4— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
<html> without a lang REDACTED:2— The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en").
TodoComment scripts/validate_unwanted_patterns.py:42— # TODO(4.0): GH#55043 - remove upon removal of CoW option
TodoComment pandas/tests/test_downstream.py:41— # TODO(CoW) see https://github.com/pandas-dev/pandas/pull/51082
TodoComment pandas/tests/test_downstream.py:255— # TODO: could check with arraylike of Period objects — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/util/test_assert_almost_equal.py:473— # TODO: to get the same deprecation in assert_numpy_array_equal we need — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/util/test_assert_almost_equal.py:475— # TODO: to get the same deprecation in assert_index_equal we need to — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/tslibs/test_array_to_datetime.py:27— # TODO: tests that include tzs, ints — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/tseries/offsets/test_business_hour.py:996— # TODO(GH#55564): as_unit will be unnecessary
TodoComment pandas/tests/tseries/offsets/test_offsets.py:611— # TODO(GH#55564): as_unit will be unnecessary
TodoComment pandas/tests/arithmetic/test_datetime64.py:1349— # TODO(GH#55564): as_unit will be unnecessary
TodoComment pandas/tests/arithmetic/test_datetime64.py:1470— # TODO(GH#55564): as_unit will be unnecessary
TodoComment pandas/tests/tseries/offsets/test_offsets.py:594— # TODO: belongs in arithmetic tests? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/tools/test_to_datetime.py:630— # TODO: Timestamp raises ValueError("could not convert string to Timestamp") — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/tools/test_to_datetime.py:1702— # TODO: should Index get "s" by default here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/tools/test_to_datetime.py:2381— # TODO typed array code path fails this case - internal error — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/strings/test_cat.py:380— # TODO: Strimg option, this should return string dtype — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/strings/test_extract.py:14— # TODO: should this raise TypeError — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/strings/test_find_replace.py:283— # TODO this currently works for pyarrow-backed dtypes but raises for python — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/strings/test_find_replace.py:1716— # TODO this currently works for pyarrow-backed dtypes but raises for python — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/strings/test_find_replace.py:299— # TODO should this be supported? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/strings/test_find_replace.py:1478— # TODO (https://github.com/pandas-dev/pandas/issues/63683)
TodoComment pandas/tests/strings/test_split_partition.py:443— # TODO see GH 18463 — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/series/test_arithmetic.py:882— # TODO: belongs in tests/arithmetic? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/series/test_constructors.py:851— # TODO: try to align these — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/series/test_constructors.py:2209— # TODO: make this not cast to object in pandas 3.0 — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment pandas/tests/frame/test_constructors.py:3538— # TODO: make this not cast to object in pandas 3.0 — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FileTooLong: core/frame.py pandas/core/frame.py— FileTooLong — 11151 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 10651 over it, 22.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/generic.py pandas/core/generic.py— FileTooLong — 4541 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4041 over it, 9.08× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: io/pytables.py pandas/io/pytables.py— FileTooLong — 3695 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3195 over it, 7.39× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: indexes/base.py pandas/core/indexes/base.py— FileTooLong — 3545 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3045 over it, 7.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: arrow/array.py pandas/core/arrays/arrow/array.py— FileTooLong — 3276 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2776 over it, 6.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: strings/accessor.py pandas/core/strings/accessor.py— FileTooLong — 3234 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2734 over it, 6.47× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 2451 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1951 over it, 4.90× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: indexes/multi.py pandas/core/indexes/multi.py— FileTooLong — 2340 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1840 over it, 4.68× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/series.py pandas/core/series.py— FileTooLong — 2263 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1763 over it, 4.53× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: io/stata.py pandas/io/stata.py— FileTooLong — 2140 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1640 over it, 4.28× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: reshape/merge.py pandas/core/reshape/merge.py— FileTooLong — 1905 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1405 over it, 3.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: groupby/groupby.py pandas/core/groupby/groupby.py— FileTooLong — 1867 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1367 over it, 3.73× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: _matplotlib/core.py pandas/plotting/_matplotlib/core.py— FileTooLong — 1765 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1265 over it, 3.53× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/indexing.py pandas/core/indexing.py— FileTooLong — 1623 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1123 over it, 3.25× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: sparse/array.py pandas/core/arrays/sparse/array.py— FileTooLong — 1606 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1106 over it, 3.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: internals/blocks.py pandas/core/internals/blocks.py— FileTooLong — 1496 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 996 over it, 2.99× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: internals/managers.py pandas/core/internals/managers.py— FileTooLong — 1487 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 987 over it, 2.97× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: core/apply.py pandas/core/apply.py— FileTooLong — 1406 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 906 over it, 2.81× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1398 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 898 over it, 2.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: parsers/readers.py pandas/io/parsers/readers.py— FileTooLong — 1372 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 872 over it, 2.74× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: formats/format.py pandas/io/formats/format.py— FileTooLong — 1371 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 871 over it, 2.74× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: arrays/masked.py pandas/core/arrays/masked.py— FileTooLong — 1330 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 830 over it, 2.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: window/rolling.py pandas/core/window/rolling.py— FileTooLong — 1315 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 815 over it, 2.63× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: arrays/categorical.py pandas/core/arrays/categorical.py— FileTooLong — 1269 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 769 over it, 2.54× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: arrays/datetimes.py pandas/core/arrays/datetimes.py— FileTooLong — 1258 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 758 over it, 2.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
Hotspot: pandas/core/frame.py pandas/core/frame.py:17063— pandas/core/frame.py changed 76 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in DataFrame._reduce at line 17063. 36 of those changes were fix/bug commits, and the other 40 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/frame.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/io/parsers/readers.py pandas/io/parsers/readers.py:840— pandas/io/parsers/readers.py changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in readers._read_csv_chunks at line 840. 15 of those changes were fix/bug commits, and the other 17 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/io/parsers/readers.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/generic.py pandas/core/generic.py:10411— pandas/core/generic.py changed 47 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in NDFrame._where at line 10411. 18 of those changes were fix/bug commits, and the other 29 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/generic.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/arrays/arrow/array.py pandas/core/arrays/arrow/array.py:1462— pandas/core/arrays/arrow/array.py changed 48 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in ArrowExtensionArray._evaluate_op_method at line 1462. 35 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/arrays/arrow/array.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/indexes/base.py pandas/core/indexes/base.py:4590— pandas/core/indexes/base.py changed 37 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in Index.join at line 4590. 18 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/indexes/base.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/arrays/sparse/array.py pandas/core/arrays/sparse/array.py:652— pandas/core/arrays/sparse/array.py changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in SparseArray.__init__ at line 652. 41 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/arrays/sparse/array.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/indexes/multi.py pandas/core/indexes/multi.py:4223— pandas/core/indexes/multi.py changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in MultiIndex._get_locs at line 4223. 14 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/indexes/multi.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/io/pytables.py pandas/io/pytables.py:4821— pandas/io/pytables.py changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in Table._create_axes at line 4821. 15 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/io/pytables.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:769— REDACTED changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in common.get_handle at line 769. 8 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/plotting/_matplotlib/core.py pandas/plotting/_matplotlib/core.py:152— pandas/plotting/_matplotlib/core.py changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in MPLPlot.__init__ at line 152. 19 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/plotting/_matplotlib/core.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/_testing/asserters.py pandas/_testing/asserters.py:1039— pandas/_testing/asserters.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in asserters.assert_series_equal at line 1039. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/_testing/asserters.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/indexing.py pandas/core/indexing.py:2773— pandas/core/indexing.py changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in _iLocIndexer._setitem_with_indexer_split_path at line 2773. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/indexing.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/resample.py pandas/core/resample.py:2459— pandas/core/resample.py changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in TimeGrouper.__init__ at line 2459. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/resample.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:763— REDACTED changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in Styler.to_latex at line 763. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/io/stata.py pandas/io/stata.py:1663— pandas/io/stata.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in StataReader.read at line 1663. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/io/stata.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/io/parsers/python_parser.py pandas/io/parsers/python_parser.py:618— pandas/io/parsers/python_parser.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in PythonParser._infer_columns at line 618. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/io/parsers/python_parser.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/io/json/_json.py pandas/io/json/_json.py:158— pandas/io/json/_json.py changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in _json.to_json at line 158. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/io/json/_json.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/internals/blocks.py pandas/core/internals/blocks.py:832— pandas/core/internals/blocks.py changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in Block.replace_list at line 832. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/internals/blocks.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/computation/eval.py pandas/core/computation/eval.py:205— pandas/core/computation/eval.py changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in eval.eval at line 205. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/computation/eval.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/groupby/generic.py pandas/core/groupby/generic.py:1047— pandas/core/groupby/generic.py changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in SeriesGroupBy.value_counts at line 1047. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/groupby/generic.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/arrays/datetimes.py pandas/core/arrays/datetimes.py:3178— pandas/core/arrays/datetimes.py changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in datetimes._generate_range at line 3178. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/arrays/datetimes.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/internals/managers.py pandas/core/internals/managers.py:1305— pandas/core/internals/managers.py changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in BlockManager.iset at line 1305. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/internals/managers.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/apply.py pandas/core/apply.py:2015— pandas/core/apply.py changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in apply.reconstruct_func at line 2015. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/apply.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/groupby/ops.py pandas/core/groupby/ops.py:389— pandas/core/groupby/ops.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in WrappedCythonOp._call_cython_op at line 389. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/groupby/ops.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: pandas/core/tools/datetimes.py pandas/core/tools/datetimes.py:849— pandas/core/tools/datetimes.py changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in datetimes.to_datetime at line 849. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/tools/datetimes.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
TooManyMethods: DataFrame pandas/core/frame.py:288— TooManyMethods — 249 methods. The bar is 30 methods; this is 219 over it, 8.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Index pandas/core/indexes/base.py:323— TooManyMethods — 207 methods. The bar is 30 methods; this is 177 over it, 6.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: NDFrame pandas/core/generic.py:271— TooManyMethods — 194 methods. The bar is 30 methods; this is 164 over it, 6.47× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Series pandas/core/series.py:224— TooManyMethods — 166 methods. The bar is 30 methods; this is 136 over it, 5.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ArrowExtensionArray pandas/core/arrays/arrow/array.py:523— TooManyMethods — 144 methods. The bar is 30 methods; this is 114 over it, 4.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MultiIndex pandas/core/indexes/multi.py:204— TooManyMethods — 101 methods. The bar is 30 methods; this is 71 over it, 3.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BaseMaskedArray pandas/core/arrays/masked.py:177— TooManyMethods — 85 methods. The bar is 30 methods; this is 55 over it, 2.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: SparseArray pandas/core/arrays/sparse/array.py:563— TooManyMethods — 76 methods. The bar is 30 methods; this is 46 over it, 2.53× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ExtensionArray pandas/core/arrays/base.py:126— TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Categorical pandas/core/arrays/categorical.py:261— TooManyMethods — 71 methods. The bar is 30 methods; this is 41 over it, 2.37× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: RangeIndex pandas/core/indexes/range.py:157— TooManyMethods — 68 methods. The bar is 30 methods; this is 38 over it, 2.27× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: GroupBy pandas/core/groupby/groupby.py:769— TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: StringMethods pandas/core/strings/accessor.py:151— TooManyMethods — 63 methods. The bar is 30 methods; this is 33 over it, 2.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DatetimeLikeArrayMixin pandas/core/arrays/datetimelike.py:193— TooManyMethods — 62 methods. The bar is 30 methods; this is 32 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Block pandas/core/internals/blocks.py:146— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ObjectStringArrayMixin pandas/core/strings/object_array.py:36— TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Styler REDACTED:82— TooManyMethods — 54 methods. The bar is 30 methods; this is 24 over it, 1.80× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: IntervalArray pandas/core/arrays/interval.py:138— TooManyMethods — 53 methods. The bar is 30 methods; this is 23 over it, 1.77× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ArrowStringArrayMixin pandas/core/arrays/_arrow_string_mixins.py:38— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: BaseBlockManager pandas/core/internals/managers.py:146— TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Expression pandas/core/col.py:81— TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: StataReader pandas/io/stata.py:1032— TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: MPLPlot pandas/plotting/_matplotlib/core.py:127— TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: HDFStore pandas/io/pytables.py:558— TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: DatetimeTimedeltaMixin pandas/core/indexes/datetimelike.py:683— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Low cohesion: DataFrame (LCOM4 60) pandas/core/frame.py:288— DataFrame's methods fall into 60 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 60 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Series (LCOM4 20) pandas/core/series.py:224— Series's methods fall into 20 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 20 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: NDFrame (LCOM4 19) pandas/core/generic.py:271— NDFrame's methods fall into 19 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 19 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ExtensionArray (LCOM4 10) pandas/core/arrays/base.py:126— ExtensionArray's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: TimedeltaArray (LCOM4 10) pandas/core/arrays/timedeltas.py:141— TimedeltaArray's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: PeriodArray (LCOM4 9) pandas/core/arrays/period.py:125— PeriodArray's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: IntervalIndex (LCOM4 9) pandas/core/indexes/interval.py:146— IntervalIndex's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ExtensionDtype (LCOM4 4) pandas/core/dtypes/base.py:49— ExtensionDtype's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: DatetimeIndex (LCOM4 4) pandas/core/indexes/datetimes.py:117— DatetimeIndex's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: ExcelWriter (LCOM4 4) pandas/io/excel/_base.py:1003— ExcelWriter's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: _TableBuilderVerboseMixin (LCOM4 4) pandas/io/formats/info.py:563— _TableBuilderVerboseMixin's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: GenericFixed (LCOM4 4) pandas/io/pytables.py:3570— GenericFixed's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Repeated repair: REDACTED REDACTED:464— REDACTED changed 11 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is BinOp.convert_values at line 464), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: query/eval with unprefixed Timestamp/datetime calls (GH#50442) (#71830)”; “BUG: eval/query TypeError adding a string to a string column (GH#47734) (#71792)”; “BUG: eval/query with Timestamp or Timedelta scalar arithmetic (GH#52559) (#71234)”; “BUG: query with tz-aware column vs naive date string (GH#26236) (#71091)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/io/sas/sas7bdat.py pandas/io/sas/sas7bdat.py:1010— pandas/io/sas/sas7bdat.py changed 10 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is SAS7BDATReader.read at line 1010), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: read_sas IndexError for column text on SAS7BDAT amd pages (GH#60809) (#70809)”; “BUG: read_sas exhausted memory on a SAS7BDAT file claiming more rows than it holds (#70721)”; “BUG: read_sas returns rows deleted from a SAS7BDAT file (GH#15963) (#70734)”; “BUG: read_sas held a SAS7BDAT file open until a cyclic collection (#68973)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/io/sas/sas7bdat.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/plotting/_matplotlib/timeseries.py pandas/plotting/_matplotlib/timeseries.py:123— pandas/plotting/_matplotlib/timeseries.py changed 9 times in last 90 days and 8 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is timeseries.maybe_resample at line 123), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: ts plot redraws series removed by ax.clear()/line.remove() (GH#54485) (#72052)”; “BUG: bar error caps/axhline misplace secondary_y line on time-series bar plot (#71436)”; “BUG: misaligned period-end timestamps on mixed-freq ts axes (GH#11574) (#71399)”; “BUG: datetimes on a sharex/twinx sibling of a time-series plot drawn off-screen (GH#40470) (#71685)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/plotting/_matplotlib/timeseries.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/arrays/_arrow_string_mixins.py pandas/core/arrays/_arrow_string_mixins.py:113— pandas/core/arrays/_arrow_string_mixins.py changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is ArrowStringArrayMixin._needs_python_regex at line 113), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: \s and \S in str regex methods missing Python whitespace characters for pyarrow-backed strings (#71025)”; “BUG: fix string regex operations with $ end indicator (always match Python behaviour) (#71387)”; “BUG: fix string regex operations with Python unicode escape sequence (#71383)”; “BUG: str regex \w, \d, \s and \b only matching ASCII for pyarrow-backed strings (#70773)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/arrays/_arrow_string_mixins.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/computation/expr.py pandas/core/computation/expr.py:693— pandas/core/computation/expr.py changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is BaseExprVisitor.visit_Call at line 693), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: DataFrame.eval assigning to a backtick-quoted name used the cleaned identifier as the column label (#70575)”; “BUG: unary op on object/string column in eval/query with numexpr (GH#45876) (#71831)”; “BUG: eval/query with numexpr on object or string columns (GH#27639) (#71228)”; “BUG: eval/query with Timestamp or Timedelta scalar arithmetic (GH#52559) (#71234)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/computation/expr.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/computation/expressions.py pandas/core/computation/expressions.py:97— pandas/core/computation/expressions.py changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is expressions._can_use_numexpr at line 97), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: int with float32 arithmetic loses precision on large inputs with… (#71458)”; “BUG: don't use numexpr for integer pow (GH#54546) (#71096)”; “BUG: numexpr results use a nonstandard int64 type, breaking select_dtypes (GH#17945) (#69427)”; “BUG: defer the blocked-numexpr warning to first use (GH#66956) (#68465)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/computation/expressions.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/common.py pandas/core/common.py:245— pandas/core/common.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is common.asarray_tuplesafe at line 245), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: drop with a bytes or __getitem__-only label (GH#11740) (#72039)”; “BUG: list of nested-tuple labels raises ValueError (GH#43780) (#71793)”; “BUG: spurious ChainedAssignmentError when setitem is called from cython (GH#51315) (#67029)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/common.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/arrays/numpy_.py pandas/core/arrays/numpy_.py:257— pandas/core/arrays/numpy_.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is NumpyExtensionArray.__array_ufunc__ at line 257), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: unary -, +, abs on object dtype with None (GH#42862) (#72045)”; “BUG: the logical ufuncs were not rejected against datetimelike data (GH#68524) (#68524)”; “BUG: NumpyExtensionArray repr double-quoted numpy bytes values (#68080)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/arrays/numpy_.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/util/hashing.py pandas/core/util/hashing.py:365— pandas/core/util/hashing.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is hashing._hash_ndarray at line 365), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: hash_pandas_object raised on mixed-type values with non-ASCII bytes (GH#27215) (#70493)”; “BUG: hash_pandas_object on DataFrame with no columns and index=False (GH#24318) (#69489)”; “BUG: hash_pandas_object gave different hashes for equal float and complex values (GH#28363) (#66955)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/util/hashing.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/arrays/sparse/accessor.py pandas/core/arrays/sparse/accessor.py:412— pandas/core/arrays/sparse/accessor.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is SparseFrameAccessor.to_coo at line 412), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: DataFrame.sparse.from_spmatrix gave the unstored entries a missing value (GH#59212) (#69115)”; “BUG: DataFrame.sparse.density warned for a frame with no columns (#68564)”; “BUG: SparseArray.density raised ZeroDivisionError on an empty array (#68468)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/arrays/sparse/accessor.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: pandas/core/ops/invalid.py pandas/core/ops/invalid.py:134— pandas/core/ops/invalid.py changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is invalid._is_datetimelike_dtype at line 134), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “BUG: the logical ufuncs were not rejected against datetimelike data (GH#68524) (#68524)”; “BUG: sparse comparisons densified a masked operand and lost its NA (#68579)”; “BUG: bool operands were not rejected against datetimelike data (GH#68452) (#68452)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 09:30:55 -08:00' --until='2026-11-14 09:30:55 -08:00' --full-history --no-merges -- pandas/core/ops/invalid.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
HackComment pandas/tests/reshape/test_get_dummies.py:160— # hack (NaN handling in assert_index_equal) — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pandas/tests/io/test_sql.py:1833— # HACK! — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pandas/tests/io/test_sql.py:4633— # HACK! Change this once indexes are handled properly. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pandas/tests/indexing/test_coercion.py:205— # Hack, in the 2nd test case, since 1.1 can be losslessly cast to float32 — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pandas/plotting/_matplotlib/hist.py:514— # hack until the plotting interface is a bit more unified — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pandas/io/html.py:822— # HACK: lxml does not clean up the clearly-erroneous — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pandas/io/pytables.py:5294— # hack until we support reversed dim flags — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment pandas/io/formats/css.py:399— # hack for 'large' etc. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
FixmeComment pandas/tests/io/test_orc.py:330— # FIXME: without casting to ns we do not round-trip correctly — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pandas/tests/indexes/test_any_index.py:53— # FIXME: doesn't belong in this file anymore! — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pandas/tests/indexes/datetimes/test_constructors.py:1026— # FIXME: The Timestamp constructor here behaves differently than all — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pandas/tests/frame/test_constructors.py:2946— # FIXME(GH#35417): until GH#35417, iloc.setitem into EA values does not preserve
FixmeComment pandas/tests/frame/test_constructors.py:2957— # FIXME(GH#35417): enable after GH#35417
FixmeComment pandas/core/reshape/merge.py:1641— # FIXME: what about other NAs? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pandas/core/indexes/multi.py:3907— # FIXME: we should be only dropping levels on which we are — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pandas/core/indexes/multi.py:4016— # FIXME: this message can be inaccurate, e.g. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
Swallowed exception (empty catch) pandas/plotting/_matplotlib/converter.py:423— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) pandas/plotting/_matplotlib/converter.py:541— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) pandas/io/_util.py:400— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) pandas/io/parsers/readers.py:1298— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) pandas/io/json/_json.py:1669— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) pandas/core/apply.py:1274— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) pandas/core/frame.py:15536— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Duplicated block (13 lines × 2) pandas/core/arrays/masked.py:1004— pandas/core/arrays/masked.py:1004-1016 | pandas/core/arrays/sparse/array.py:2993-3005 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: `ExtensionArray` names `pandas.core.arrays` in one and `pandas.core.arrays.base` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (13 lines × 2) pandas/core/internals/blocks.py:1920— pandas/core/internals/blocks.py:1920-1932 | pandas/core/internals/blocks.py:1998-2010 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/internals/blocks.py:1920` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) pandas/core/window/ewm.py:606— pandas/core/window/ewm.py:606-618 | pandas/core/window/ewm.py:697-709 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/window/ewm.py:606` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) REDACTED:417— REDACTED:417-429 | REDACTED:515-527 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:414` calls `items`, `isinstance`, `register_namespace` and `REDACTED:514` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (13 lines × 2) REDACTED:226— REDACTED:226-238 | REDACTED:345-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:226` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) pandas/core/arrays/_mixins.py:653— pandas/core/arrays/_mixins.py:653-665 | pandas/core/arrays/categorical.py:2155-2170 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. Note first that the copies are not typed on the same thing: the declarations holding them bind `dtype` to `ExtensionDtype` in one and `CategoricalDtype` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12 lines × 2) pandas/core/arrays/datetimelike.py:953— pandas/core/arrays/datetimelike.py:953-964 | pandas/core/arrays/interval.py:743-754 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (12 lines × 2) pandas/core/arrays/interval.py:876— pandas/core/arrays/interval.py:876-887 | pandas/core/arrays/interval.py:893-904 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) pandas/core/groupby/generic.py:3106— pandas/core/groupby/generic.py:3106-3117 | pandas/core/groupby/generic.py:3122-3133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/groupby/generic.py:3106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) pandas/core/groupby/ops.py:944— pandas/core/groupby/ops.py:944-955 | pandas/core/groupby/ops.py:1011-1022 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (12 lines × 2) pandas/core/nanops.py:829— pandas/core/nanops.py:829-840 | pandas/core/nanops.py:1877-1888 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) pandas/io/stata.py:2399— pandas/io/stata.py:2399-2410 | pandas/io/stata.py:3232-3243 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/io/stata.py:2399` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) pandas/core/arrays/categorical.py:2745— pandas/core/arrays/categorical.py:2745-2752 | pandas/core/arrays/categorical.py:2777-2784 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) pandas/core/indexes/range.py:1363— pandas/core/indexes/range.py:1363-1370 | pandas/core/indexes/range.py:1378-1385 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) pandas/io/excel/_openpyxl.py:767— pandas/io/excel/_openpyxl.py:767-775 | pandas/io/excel/_pyxlsb.py:141-148 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8 lines × 2) REDACTED:593— REDACTED:593-600 | REDACTED:861-868 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:593` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pandas/plotting/_matplotlib/converter.py:1000— pandas/plotting/_matplotlib/converter.py:1000-1007 | pandas/plotting/_matplotlib/converter.py:1049-1056 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) pandas/core/groupby/groupby.py:881— pandas/core/groupby/groupby.py:881-888 | pandas/core/window/rolling.py:304-311 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×5
Edited copy of a member (9 corresponding lines) pandas/core/arrays/arrow/array.py:4294— pandas/core/arrays/arrow/array.py:4294-4302 | pandas/core/arrays/arrow/array.py:4311-4321 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) pandas/io/stata.py:3681— pandas/io/stata.py:3681-3689 | pandas/io/stata.py:3705-3717 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) pandas/core/arrays/arrow/array.py:2580— pandas/core/arrays/arrow/array.py:2580-2592 | pandas/core/arrays/arrow/array.py:2595-2603 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) pandas/core/generic.py:1397— pandas/core/generic.py:1397-1408 | pandas/core/generic.py:1412-1420 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) pandas/core/arrays/string_arrow.py:494— pandas/core/arrays/string_arrow.py:494-502 | pandas/core/arrays/string_arrow.py:540-549 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (10 lines × 2) doc/sphinxext/announce.py:92— doc/sphinxext/announce.py:92-101 | doc/sphinxext/announce.py:103-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pandas/core/arrays/timedeltas.py:717— pandas/core/arrays/timedeltas.py:717-726 | pandas/core/arrays/timedeltas.py:768-777 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pandas/core/computation/expr.py:476— pandas/core/computation/expr.py:476-485 | pandas/core/computation/expr.py:486-495 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pandas/core/reshape/merge.py:2142— pandas/core/reshape/merge.py:2142-2151 | pandas/core/reshape/merge.py:2154-2163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) pandas/io/sql/sqla.py:652— pandas/io/sql/sqla.py:652-661 | pandas/io/sql/sqlite.py:530-539 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×4
Edited copy of a member (10 corresponding lines) pandas/io/stata.py:1377— pandas/io/stata.py:1377-1386 | pandas/io/stata.py:1389-1398 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) pandas/core/arrays/arrow/array.py:3526— pandas/core/arrays/arrow/array.py:3526-3535 | pandas/core/arrays/arrow/array.py:3539-3548 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) pandas/core/arrays/datetimelike.py:1099— pandas/core/arrays/datetimelike.py:1099-1112 | pandas/core/arrays/datetimelike.py:1116-1125 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) pandas/io/sql/adbc.py:64— pandas/io/sql/adbc.py:64-73 | pandas/io/sql/base.py:219-230 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
X17 · Uncapped recursion over a caller-supplied document· Recursive walk over a caller-supplied document has no depth cap · ×4
Recursive walk over a caller-supplied document has no depth cap pandas/core/common.py:382— `get_callable_name` is public and takes `obj: object` from its caller, and it calls itself at line 382 (`get_callable_name`) with a piece of `obj` — and nowhere in `get_callable_name` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `get_callable_name` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap pandas/core/dtypes/cast.py:784— `infer_dtype_from_scalar` is public and takes `val: object` from its caller, and it calls itself at line 784 (`infer_dtype_from_scalar`) with a piece of `val` — and nowhere in `infer_dtype_from_scalar` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `infer_dtype_from_scalar` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap pandas/core/dtypes/cast.py:1823— `np_can_hold_element` is public and takes `element: Any` from its caller, and it calls itself at line 1823 (`np_can_hold_element`) with a piece of `element` — and nowhere in `np_can_hold_element` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `np_can_hold_element` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Recursive walk over a caller-supplied document has no depth cap pandas/_testing/__init__.py:536— `shares_memory` is public and takes `left: Any` from its caller, and it calls itself at line 536 (`shares_memory`) with a piece of `left` (and at line 539, line 540, line 543, line 545, line 547, line 564, line 567, line 571) — and nowhere in `shares_memory` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `shares_memory` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D4 · Code Duplication· Edited copy of a member (58 corresponding lines) · ×3
Edited copy of a member (58 corresponding lines) pandas/tseries/frequencies.py:544— pandas/tseries/frequencies.py:544-601 | pandas/tseries/frequencies.py:605-663 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (58 corresponding lines) pandas/core/series.py:7226— pandas/core/series.py:7226-7297 | pandas/core/series.py:7304-7361 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (58 corresponding lines) pandas/core/generic.py:9311— pandas/core/generic.py:9311-9368 | pandas/core/generic.py:9378-9451 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (49 corresponding lines) · ×3
Edited copy of a member (49 corresponding lines) pandas/core/nanops.py:1724— pandas/core/nanops.py:1724-1772 | pandas/core/nanops.py:1785-1833 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (49 corresponding lines) pandas/core/groupby/numba_.py:72— pandas/core/groupby/numba_.py:72-120 | pandas/core/groupby/numba_.py:129-177 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (49 corresponding lines) pandas/core/window/numba_.py:27— pandas/core/window/numba_.py:27-75 | pandas/core/window/numba_.py:182-232 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×3
Edited copy of a member (12 corresponding lines) pandas/core/arrays/_arrow_string_mixins.py:440— pandas/core/arrays/_arrow_string_mixins.py:440-451 | pandas/core/arrays/_arrow_string_mixins.py:456-467 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) pandas/core/window/rolling.py:1767— pandas/core/window/rolling.py:1767-1782 | pandas/core/window/rolling.py:1791-1802 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) pandas/tseries/frequencies.py:420— pandas/tseries/frequencies.py:420-431 | pandas/tseries/frequencies.py:434-445 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×3
Edited copy of a member (13 corresponding lines) pandas/core/indexes/interval.py:105— pandas/core/indexes/interval.py:105-117 | pandas/core/indexes/interval.py:122-134 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) pandas/core/arrays/masked.py:1848— pandas/core/arrays/masked.py:1848-1860 | pandas/core/arrays/masked.py:1870-1882 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) scripts/check_for_inconsistent_pandas_namespace.py:121— scripts/check_for_inconsistent_pandas_namespace.py:121-135 | scripts/sort_whatsnew_note.py:66-78 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×3
Edited copy of a member (15 corresponding lines) pandas/core/arrays/timedeltas.py:747— pandas/core/arrays/timedeltas.py:747-763 | pandas/core/arrays/timedeltas.py:798-812 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) pandas/core/arrays/interval.py:876— pandas/core/arrays/interval.py:876-890 | pandas/core/arrays/interval.py:893-907 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) pandas/core/interchange/column.py:256— pandas/core/interchange/column.py:256-270 | pandas/core/interchange/dataframe.py:99-113 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×3
Edited copy of a member (8 corresponding lines) pandas/core/arrays/arrow/array.py:1732— pandas/core/arrays/arrow/array.py:1732-1743 | pandas/core/arrays/masked.py:540-547 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) pandas/core/arrays/string_arrow.py:578— pandas/core/arrays/string_arrow.py:578-586 | pandas/core/arrays/string_arrow.py:589-596 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) pandas/io/sql/adbc.py:77— pandas/io/sql/adbc.py:77-108 | pandas/io/sql/sqlite.py:87-94 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×3
Edited copy of a member (7 corresponding lines) pandas/core/arrays/datetimes.py:562— pandas/core/arrays/datetimes.py:562-568 | pandas/core/arrays/timedeltas.py:347-356 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) pandas/core/series.py:7453— pandas/core/series.py:7453-7460 | pandas/core/indexes/base.py:7851-7857 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) pandas/core/_numba/kernels/mean_.py:56— pandas/core/_numba/kernels/mean_.py:56-64 | pandas/core/_numba/kernels/sum_.py:56-62 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (35 lines × 2) pandas/core/nanops.py:1724— pandas/core/nanops.py:1724-1758 | pandas/core/nanops.py:1785-1819 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35 lines × 2) pandas/core/window/numba_.py:27— pandas/core/window/numba_.py:27-61 | pandas/core/window/numba_.py:182-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/window/numba_.py:27` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `func` to `Callable[..., Scalar]` in one and `Callable[..., np.ndarray]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (35 lines × 2) REDACTED:1448— REDACTED:1448-1482 | REDACTED:1750-1784 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) pandas/core/frame.py:19477— pandas/core/frame.py:19477-19491 | pandas/core/frame.py:19576-19590 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/frame.py:19477` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15 lines × 2) pandas/io/sql/adbc.py:137— pandas/io/sql/adbc.py:137-151 | pandas/io/sql/sqlite.py:295-309 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: `Error` names `adbc_driver_manager` in one and `sqlite3` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (15 lines × 2) pandas/plotting/_matplotlib/core.py:2240— pandas/plotting/_matplotlib/core.py:2240-2254 | pandas/plotting/_matplotlib/core.py:2282-2296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14 lines × 2) pandas/core/arrays/datetimes.py:1397— pandas/core/arrays/datetimes.py:1397-1410 | pandas/core/arrays/datetimes.py:1481-1494 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) pandas/core/groupby/groupby.py:3344— pandas/core/groupby/groupby.py:3344-3357 | pandas/core/groupby/groupby.py:3415-3428 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) pandas/tseries/frequencies.py:588— pandas/tseries/frequencies.py:588-601 | pandas/tseries/frequencies.py:650-663 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/tseries/frequencies.py:588` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Swallowed exception (caught, then discarded) pandas/plotting/_matplotlib/converter.py:399— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pandas/plotting/_matplotlib/core.py:1864— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pandas/io/json/_json.py:1758— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
DataFrame.set_index (cyclomatic 23) pandas/core/frame.py:7753— DataFrame.set_index has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (DataFrame.set_index) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.set_index (cyclomatic 23) pandas/core/frame.py:7763— DataFrame.set_index has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (DataFrame.set_index) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NDFrame._rename (cyclomatic 22) pandas/core/generic.py:1035— NDFrame._rename has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (NDFrame._rename) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NDFrame._rename (cyclomatic 22) pandas/core/generic.py:1048— NDFrame._rename has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (NDFrame._rename) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Index.set_names (cyclomatic 20) pandas/core/indexes/base.py:2050— Index.set_names has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Index.set_names) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Index.set_names (cyclomatic 20) pandas/core/indexes/base.py:2058— Index.set_names has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Index.set_names) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.quantile (cyclomatic 18) pandas/core/frame.py:19720— DataFrame.quantile has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (DataFrame.quantile) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.quantile (cyclomatic 18) pandas/core/frame.py:19729— DataFrame.quantile has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (DataFrame.quantile) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
XxxComment pandas/io/stata.py:3442— # xxx...xxx — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment pandas/io/formats/format.py:1453— # xxx+nanj — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
DataFrame.set_index (cognitive 36) pandas/core/frame.py:7753— DataFrame.set_index has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (29 pts), error handling 1 (3 pts), loops 3, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.set_index) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.set_index (cognitive 36) pandas/core/frame.py:7763— DataFrame.set_index has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (29 pts), error handling 1 (3 pts), loops 3, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.set_index) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NDFrame._rename (cognitive 36) pandas/core/generic.py:1035— NDFrame._rename has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (NDFrame._rename) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NDFrame._rename (cognitive 36) pandas/core/generic.py:1048— NDFrame._rename has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (NDFrame._rename) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.quantile (cognitive 31) pandas/core/frame.py:19720— DataFrame.quantile has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 1, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.quantile) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.quantile (cognitive 31) pandas/core/frame.py:19729— DataFrame.quantile has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 1, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.quantile) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NDFrame.rename_axis (cognitive 23) pandas/core/generic.py:1145— NDFrame.rename_axis has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (NDFrame.rename_axis) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
NDFrame.rename_axis (cognitive 23) pandas/core/generic.py:1156— NDFrame.rename_axis has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (NDFrame.rename_axis) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Index.set_names (cognitive 23) pandas/core/indexes/base.py:2050— Index.set_names has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Index.set_names) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Index.set_names (cognitive 23) pandas/core/indexes/base.py:2058— Index.set_names has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (Index.set_names) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
cast.find_common_type (cognitive 20) pandas/core/dtypes/cast.py:1321— cast.find_common_type has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (cast.find_common_type) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
cast.find_common_type (cognitive 20) pandas/core/dtypes/cast.py:1324— cast.find_common_type has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (cast.find_common_type) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
BaseMaskedArray.astype (cognitive 18) pandas/core/arrays/masked.py:801— BaseMaskedArray.astype has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (BaseMaskedArray.astype) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
BaseMaskedArray.astype (cognitive 18) pandas/core/arrays/masked.py:803— BaseMaskedArray.astype has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: one other method here (BaseMaskedArray.astype) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Categorical.astype (cognitive 17) pandas/core/arrays/categorical.py:590— Categorical.astype has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Categorical.astype) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Categorical.astype (cognitive 17) pandas/core/arrays/categorical.py:592— Categorical.astype has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Categorical.astype) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.query (cognitive 17) pandas/core/frame.py:5059— DataFrame.query has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.query) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
DataFrame.query (cognitive 17) pandas/core/frame.py:5072— DataFrame.query has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DataFrame.query) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
Members sharing a duplicated core (4 members, 50+ identical tokens) pandas/core/internals/blocks.py:1257— pandas/core/internals/blocks.py:1257-1321 | pandas/core/internals/blocks.py:1324-1431 | pandas/core/internals/blocks.py:1868-1940 | pandas/core/internals/blocks.py:1944-2017 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) pandas/core/strings/accessor.py:752— pandas/core/strings/accessor.py:752-947 | pandas/core/strings/accessor.py:951-1084 | pandas/core/strings/accessor.py:1088-1176 | pandas/core/strings/accessor.py:1180-1268 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (70 corresponding lines) · ×2
Edited copy of a member (70 corresponding lines) pandas/core/window/numba_.py:270— pandas/core/window/numba_.py:270-349 | pandas/core/window/online.py:22-91 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (70 corresponding lines) pandas/core/frame.py:19918— pandas/core/frame.py:19918-19997 | pandas/core/frame.py:20005-20074 — These two members are one piece of code written twice and then edited apart: 70 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (73 corresponding lines) · ×2
Edited copy of a member (73 corresponding lines) pandas/core/indexes/base.py:8146— pandas/core/indexes/base.py:8146-8218 | pandas/core/indexes/base.py:8227-8300 — These two members are one piece of code written twice and then edited apart: 73 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (73 corresponding lines) pandas/core/groupby/generic.py:1371— pandas/core/groupby/generic.py:1371-1443 | pandas/core/groupby/groupby.py:5071-5152 — These two members are one piece of code written twice and then edited apart: 73 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (37 corresponding lines) · ×2
Edited copy of a member (37 corresponding lines) REDACTED:371— REDACTED:371-407 | REDACTED:463-499 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (37 corresponding lines) pandas/core/groupby/groupby.py:1199— pandas/core/groupby/groupby.py:1199-1235 | pandas/core/groupby/groupby.py:1239-1275 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×2
Edited copy of a member (31 corresponding lines) pandas/core/indexes/multi.py:958— pandas/core/indexes/multi.py:958-989 | pandas/core/indexes/multi.py:1204-1234 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) pandas/core/indexes/datetimes.py:1071— pandas/core/indexes/datetimes.py:1071-1112 | pandas/core/indexes/interval.py:476-506 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) pandas/core/arrays/timedeltas.py:716— pandas/core/arrays/timedeltas.py:716-742 | pandas/core/arrays/timedeltas.py:767-794 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) REDACTED:483— REDACTED:483-522 | REDACTED:608-634 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (50 corresponding lines) · ×2
Edited copy of a member (50 corresponding lines) pandas/core/indexes/datetimes.py:2217— pandas/core/indexes/datetimes.py:2217-2266 | pandas/core/indexes/period.py:1027-1086 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (50 corresponding lines) pandas/core/arrays/_mixins.py:452— pandas/core/arrays/_mixins.py:452-501 | pandas/core/arrays/base.py:1456-1525 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (80 corresponding lines) · ×2
Edited copy of a member (80 corresponding lines) pandas/core/arrays/masked.py:1978— pandas/core/arrays/masked.py:1978-2057 | pandas/core/arrays/masked.py:2072-2151 — These two members are one piece of code written twice and then edited apart: 80 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (80 corresponding lines) pandas/core/frame.py:7284— pandas/core/frame.py:7284-7421 | pandas/core/series.py:6148-6227 — These two members are one piece of code written twice and then edited apart: 80 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×2
Edited copy of a member (21 corresponding lines) pandas/core/indexes/datetimes.py:83— pandas/core/indexes/datetimes.py:83-113 | pandas/core/indexes/timedeltas.py:71-91 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) REDACTED:460— REDACTED:460-480 | REDACTED:576-605 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×2
Edited copy of a member (17 corresponding lines) pandas/core/indexes/accessors.py:256— pandas/core/indexes/accessors.py:256-274 | pandas/core/indexes/accessors.py:277-293 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) pandas/core/apply.py:1515— pandas/core/apply.py:1515-1531 | pandas/core/apply.py:1719-1737 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×2
Edited copy of a member (23 corresponding lines) pandas/core/apply.py:1490— pandas/core/apply.py:1490-1512 | pandas/core/apply.py:1693-1716 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (23 corresponding lines) pandas/core/_numba/kernels/mean_.py:174— pandas/core/_numba/kernels/mean_.py:174-198 | pandas/core/_numba/kernels/sum_.py:232-254 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×2
Edited copy of a member (29 corresponding lines) REDACTED:536— REDACTED:536-573 | REDACTED:660-688 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (29 corresponding lines) pandas/io/parquet.py:58— pandas/io/parquet.py:58-94 | pandas/io/sql/sqla.py:120-148 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×2
Edited copy of a member (25 corresponding lines) pandas/core/arrays/base.py:1595— pandas/core/arrays/base.py:1595-1659 | pandas/core/arrays/sparse/array.py:1308-1332 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (25 corresponding lines) pandas/core/arrays/datetimelike.py:2413— pandas/core/arrays/datetimelike.py:2413-2437 | pandas/core/arrays/numpy_.py:399-424 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×2
Edited copy of a member (33 corresponding lines) pandas/io/stata.py:2378— pandas/io/stata.py:2378-2410 | pandas/io/stata.py:3205-3243 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (33 corresponding lines) pandas/io/excel/_pyxlsb.py:37— pandas/io/excel/_pyxlsb.py:37-69 | pandas/io/excel/_xlrd.py:38-70 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×2
Edited copy of a member (14 corresponding lines) pandas/core/arrays/base.py:2220— pandas/core/arrays/base.py:2220-2233 | pandas/core/arrays/base.py:2242-2256 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) pandas/core/_numba/kernels/mean_.py:34— pandas/core/_numba/kernels/mean_.py:34-49 | pandas/core/_numba/kernels/sum_.py:36-49 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×2
Edited copy of a member (6 corresponding lines) pandas/core/arrays/_arrow_string_mixins.py:422— pandas/core/arrays/_arrow_string_mixins.py:422-427 | pandas/core/arrays/_arrow_string_mixins.py:430-435 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) pandas/plotting/_matplotlib/core.py:1751— pandas/plotting/_matplotlib/core.py:1751-1756 | pandas/plotting/_matplotlib/hist.py:147-155 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (2 corresponding lines) · ×2
Edited copy of a member (2 corresponding lines) pandas/core/indexes/datetimes.py:1978— pandas/core/indexes/datetimes.py:1978-1979 | pandas/core/indexes/timedeltas.py:761-762 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (2 corresponding lines) pandas/core/indexes/datetimes.py:338— pandas/core/indexes/datetimes.py:338-339 | pandas/core/indexes/period.py:316-317 — These two members are one piece of code written twice and then edited apart: 2 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (22 lines × 2) pandas/core/_numba/kernels/mean_.py:82— pandas/core/_numba/kernels/mean_.py:82-103 | pandas/core/_numba/kernels/var_.py:91-112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/_numba/kernels/mean_.py:82` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `pandas/core/_numba/kernels/var_.py:90` calls `max` and `pandas/core/_numba/kernels/mean_.py:80` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (22 lines × 2) pandas/core/generic.py:2297— pandas/core/generic.py:2297-2318 | REDACTED:695-716 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/generic.py:2297` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (18–19 lines × 2) pandas/core/arrays/datetimelike.py:2420— pandas/core/arrays/datetimelike.py:2420-2437 | pandas/core/arrays/numpy_.py:406-424 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (18–19 lines × 2) pandas/core/frame.py:1196— pandas/core/frame.py:1196-1213 | pandas/core/frame.py:3415-3433 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (16 lines × 2) pandas/core/_numba/kernels/mean_.py:174— pandas/core/_numba/kernels/mean_.py:174-189 | pandas/core/_numba/kernels/sum_.py:234-249 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (16 lines × 2) pandas/core/nanops.py:2087— pandas/core/nanops.py:2087-2102 | pandas/core/nanops.py:2188-2203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13–14 lines × 2) pandas/core/arrays/arrow/array.py:1621— pandas/core/arrays/arrow/array.py:1621-1633 | pandas/core/arrays/string_.py:420-433 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/arrays/arrow/array.py:1621` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13–14 lines × 2) pandas/core/reshape/merge.py:1097— pandas/core/reshape/merge.py:1097-1110 | pandas/core/reshape/merge.py:1112-1124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pandas/core/internals/blocks.py:1311— pandas/core/internals/blocks.py:1311-1321 | pandas/core/internals/blocks.py:2005-2015 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (11 lines × 2) pandas/core/window/ewm.py:594— pandas/core/window/ewm.py:594-604 | pandas/core/window/ewm.py:685-695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/window/ewm.py:594` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pandas/plotting/_matplotlib/misc.py:277— pandas/plotting/_matplotlib/misc.py:277-283 | pandas/plotting/_matplotlib/misc.py:405-411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `pandas/plotting/_matplotlib/misc.py:276` calls `f` and `pandas/plotting/_matplotlib/misc.py:404` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 2) REDACTED:277— REDACTED:277-283 | REDACTED:402-408 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 3) pandas/plotting/_matplotlib/converter.py:927— pandas/plotting/_matplotlib/converter.py:927-933 | pandas/plotting/_matplotlib/converter.py:1000-1005 | pandas/plotting/_matplotlib/converter.py:1049-1054 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (6 lines × 3) pandas/core/nanops.py:1352— pandas/core/nanops.py:1352-1357 | pandas/core/nanops.py:1754-1759 | pandas/core/nanops.py:1815-1820 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (5 lines × 2) pandas/core/reshape/merge.py:629— pandas/core/reshape/merge.py:629-633 | pandas/core/reshape/merge.py:636-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/reshape/merge.py:636` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (5 lines × 2) pandas/core/arrays/numpy_.py:560— pandas/core/arrays/numpy_.py:560-564 | pandas/core/arrays/timedeltas.py:430-435 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
AC3 · Page structure· Page without a main landmark · ×1
Page without a main landmark pandas/io/formats/templates/html.tpl:4— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC3 · Page structure· Heading level jumps from h1 to h5 · ×1
Heading level jumps from h1 to h5 REDACTED:19— Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
Low contrast colour pair in CSS (4.2:1) web/pandas/static/css/pandas.css:113— `blockquote` sets color: #787878 on background-color: #f9f9f9 — 4.2:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety· Focus outline removed in CSS without a · ×1
Focus outline removed in CSS without a :focus replacement doc/source/_static/css/getting_started.css:32— `.gs-data .badge` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
readers._read_csv_chunks (cyclomatic 70) pandas/io/parsers/readers.py:840— readers._read_csv_chunks has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cast.np_can_hold_element (cyclomatic 68) pandas/core/dtypes/cast.py:1709— cast.np_can_hold_element has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_MergeOperation._maybe_coerce_merge_keys (cyclomatic 65) pandas/core/reshape/merge.py:1700— _MergeOperation._maybe_coerce_merge_keys has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cast.convert_dtypes (cyclomatic 55) pandas/core/dtypes/cast.py:894— cast.convert_dtypes has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
numeric.to_numeric (cyclomatic 51) pandas/core/tools/numeric.py:52— numeric.to_numeric has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Table._create_axes (cyclomatic 51) pandas/io/pytables.py:4821— Table._create_axes has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultiIndex._get_locs (cyclomatic 50) pandas/core/indexes/multi.py:4223— MultiIndex._get_locs has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
asserters.assert_series_equal (cyclomatic 47) pandas/_testing/asserters.py:1039— asserters.assert_series_equal has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NDFrame._where (cyclomatic 46) pandas/core/generic.py:10411— NDFrame._where has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
common.get_handle (cyclomatic 46) REDACTED:769— common.get_handle has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._evaluate_op_method (cyclomatic 45) pandas/core/arrays/arrow/array.py:1462— ArrowExtensionArray._evaluate_op_method has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Series.__init__ (cyclomatic 45) pandas/core/series.py:365— Series.__init__ has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Index.join (cyclomatic 44) pandas/core/indexes/base.py:4590— Index.join has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DatetimeArray._generate_range (cyclomatic 43) pandas/core/arrays/datetimes.py:399— DatetimeArray._generate_range has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultiIndex._get_loc_level (cyclomatic 43) pandas/core/indexes/multi.py:3860— MultiIndex._get_loc_level has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
readers._can_parallelize_csv (cyclomatic 43) pandas/io/parsers/readers.py:483— readers._can_parallelize_csv has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
PythonParser._infer_columns (cyclomatic 42) pandas/io/parsers/python_parser.py:618— PythonParser._infer_columns has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TextFileReader._clean_options (cyclomatic 42) pandas/io/parsers/readers.py:2925— TextFileReader._clean_options has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
construction.array (cyclomatic 41) pandas/core/construction.py:86— construction.array has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._box_pa_array (cyclomatic 40) pandas/core/arrays/arrow/array.py:957— ArrowExtensionArray._box_pa_array has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._reduce_pyarrow (cyclomatic 40) pandas/core/arrays/arrow/array.py:2941— ArrowExtensionArray._reduce_pyarrow has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
grouper.get_grouper (cyclomatic 40) pandas/core/groupby/grouper.py:745— grouper.get_grouper has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
construction.ndarray_to_mgr (cyclomatic 40) pandas/core/internals/construction.py:215— construction.ndarray_to_mgr has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_MergeOperation._maybe_add_join_keys (cyclomatic 40) pandas/core/reshape/merge.py:1277— _MergeOperation._maybe_add_join_keys has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StataReader.read (cyclomatic 40) pandas/io/stata.py:1663— StataReader.read has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
eval.eval (cyclomatic 39) pandas/core/computation/eval.py:205— eval.eval has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataFrame.__init__ (cyclomatic 39) pandas/core/frame.py:472— DataFrame.__init__ has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
algorithms.isin (cyclomatic 38) pandas/core/algorithms.py:549— algorithms.isin has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NDFrame.replace (cyclomatic 38) pandas/core/generic.py:7733— NDFrame.replace has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StringMethods._wrap_result (cyclomatic 38) pandas/core/strings/accessor.py:261— StringMethods._wrap_result has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_XMLFrameParser._iterparse_nodes (cyclomatic 38) REDACTED:285— _XMLFrameParser._iterparse_nodes has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
numeric._coerce_to_data_and_mask (cyclomatic 37) pandas/core/arrays/numeric.py:137— numeric._coerce_to_data_and_mask has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pivot.__internal_pivot_table (cyclomatic 37) pandas/core/reshape/pivot.py:293— pivot.__internal_pivot_table has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
stata._cast_to_stata_types (cyclomatic 37) pandas/io/stata.py:451— stata._cast_to_stata_types has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cast._maybe_promote (cyclomatic 36) pandas/core/dtypes/cast.py:539— cast._maybe_promote has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowParserWrapper._get_pyarrow_options (cyclomatic 36) pandas/io/parsers/arrow_parser_wrapper.py:182— ArrowParserWrapper._get_pyarrow_options has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._cast_pointwise_result (cyclomatic 35) pandas/core/arrays/arrow/array.py:763— ArrowExtensionArray._cast_pointwise_result has cyclomatic complexity 35 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
construction.sanitize_array (cyclomatic 35) pandas/core/construction.py:617— construction.sanitize_array has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataFrame._reduce (cyclomatic 35) pandas/core/frame.py:17063— DataFrame._reduce has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NDFrame.fillna (cyclomatic 35) pandas/core/generic.py:7277— NDFrame.fillna has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
WrappedCythonOp._call_cython_op (cyclomatic 35) pandas/core/groupby/ops.py:389— WrappedCythonOp._call_cython_op has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PlotAccessor.__call__ (cyclomatic 35) pandas/plotting/_core.py:1131— PlotAccessor.__call__ has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
datetimes._assemble_from_unit_mappings (cyclomatic 34) pandas/core/tools/datetimes.py:1356— datetimes._assemble_from_unit_mappings has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NDFrame.to_latex (cyclomatic 33) pandas/core/generic.py:3455— NDFrame.to_latex has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Index.__new__ (cyclomatic 33) pandas/core/indexes/base.py:499— Index.__new__ has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_json.to_json (cyclomatic 33) pandas/io/json/_json.py:158— _json.to_json has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataFrame.from_records (cyclomatic 32) pandas/core/frame.py:2075— DataFrame.from_records has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
merge._factorize_keys (cyclomatic 32) pandas/core/reshape/merge.py:2873— merge._factorize_keys has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
converter._daily_finder (cyclomatic 32) pandas/plotting/_matplotlib/converter.py:698— converter._daily_finder has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataFrame._reduce_axis1 (cyclomatic 31) pandas/core/frame.py:17244— DataFrame._reduce_axis1 has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
common._get_filepath_or_buffer (cyclomatic 31) REDACTED:331— common._get_filepath_or_buffer has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseExcelReader._parse_sheet (cyclomatic 31) pandas/io/excel/_base.py:843— BaseExcelReader._parse_sheet has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
asserters.assert_index_equal (cyclomatic 30) pandas/_testing/asserters.py:219— asserters.assert_index_equal has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SparseArray.__init__ (cyclomatic 30) pandas/core/arrays/sparse/array.py:652— SparseArray.__init__ has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
astype.astype_is_view (cyclomatic 30) pandas/core/dtypes/astype.py:313— astype.astype_is_view has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
interval.interval_range (cyclomatic 30) pandas/core/indexes/interval.py:1696— interval.interval_range has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_MergeOperation._validate_left_right_on (cyclomatic 30) pandas/core/reshape/merge.py:1890— _MergeOperation._validate_left_right_on has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ParserBase._infer_types (cyclomatic 30) pandas/io/parsers/base_parser.py:526— ParserBase._infer_types has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DatetimeLikeArrayMixin._validate_listlike (cyclomatic 29) pandas/core/arrays/datetimelike.py:616— DatetimeLikeArrayMixin._validate_listlike has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_iLocIndexer._align_series (cyclomatic 29) pandas/core/indexing.py:3236— _iLocIndexer._align_series has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
merge.get_join_indexers (cyclomatic 29) pandas/core/reshape/merge.py:2062— merge.get_join_indexers has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
datetimes._convert_listlike_datetimes (cyclomatic 29) pandas/core/tools/datetimes.py:370— datetimes._convert_listlike_datetimes has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Parser._try_convert_data (cyclomatic 29) pandas/io/json/_json.py:1538— Parser._try_convert_data has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
arraylike.array_ufunc (cyclomatic 28) pandas/core/arraylike.py:278— arraylike.array_ufunc has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseMaskedArray._arith_method (cyclomatic 28) pandas/core/arrays/masked.py:1000— BaseMaskedArray._arith_method has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
to_dict.to_dict (cyclomatic 28) pandas/core/methods/to_dict.py:101— to_dict.to_dict has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
concat._make_concat_multiindex (cyclomatic 28) pandas/core/reshape/concat.py:933— concat._make_concat_multiindex has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
melt.melt (cyclomatic 28) pandas/core/reshape/melt.py:48— melt.melt has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_AsOfMerge._validate_left_right_on (cyclomatic 28) pandas/core/reshape/merge.py:2474— _AsOfMerge._validate_left_right_on has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
algorithms.safe_sort (cyclomatic 27) pandas/core/algorithms.py:1707— algorithms.safe_sort has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._groupby_op_pyarrow (cyclomatic 27) pandas/core/arrays/arrow/array.py:3900— ArrowExtensionArray._groupby_op_pyarrow has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
IntervalArray._ensure_simple_new_inputs (cyclomatic 27) pandas/core/arrays/interval.py:293— IntervalArray._ensure_simple_new_inputs has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_iLocIndexer._setitem_with_indexer_split_path (cyclomatic 27) pandas/core/indexing.py:2773— _iLocIndexer._setitem_with_indexer_split_path has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_util._post_convert_dtypes (cyclomatic 27) pandas/io/_util.py:167— _util._post_convert_dtypes has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_normalize.json_normalize (cyclomatic 27) pandas/io/json/_normalize.py:320— _normalize.json_normalize has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
min_max_.sliding_min_max (cyclomatic 26) pandas/core/_numba/kernels/min_max_.py:39— min_max_.sliding_min_max has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
boolean.coerce_to_array (cyclomatic 26) pandas/core/arrays/boolean.py:183— boolean.coerce_to_array has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Categorical.__init__ (cyclomatic 26) pandas/core/arrays/categorical.py:400— Categorical.__init__ has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NDFrame.clip (cyclomatic 26) pandas/core/generic.py:8998— NDFrame.clip has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DatetimeIndexOpsMixin.equals (cyclomatic 26) pandas/core/indexes/datetimelike.py:308— DatetimeIndexOpsMixin.equals has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimeGrouper.__init__ (cyclomatic 26) pandas/core/resample.py:2459— TimeGrouper.__init__ has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
concat.concat (cyclomatic 26) pandas/core/reshape/concat.py:163— concat.concat has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_table_schema.parse_table_schema (cyclomatic 26) pandas/io/json/_table_schema.py:357— _table_schema.parse_table_schema has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._from_sequence_of_strings (cyclomatic 25) pandas/core/arrays/arrow/array.py:614— ArrowExtensionArray._from_sequence_of_strings has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
timedeltas.sequence_to_td64ns (cyclomatic 25) pandas/core/arrays/timedeltas.py:1223— timedeltas.sequence_to_td64ns has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cast.maybe_downcast_numeric (cyclomatic 25) pandas/core/dtypes/cast.py:315— cast.maybe_downcast_numeric has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataFrame._align_for_op (cyclomatic 25) pandas/core/frame.py:10396— DataFrame._align_for_op has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseGrouper._reduceat_aggregate (cyclomatic 25) pandas/core/groupby/ops.py:1087— BaseGrouper._reduceat_aggregate has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
api.union_indexes (cyclomatic 25) pandas/core/indexes/api.py:203— api.union_indexes has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RangeIndex._difference (cyclomatic 25) pandas/core/indexes/range.py:1115— RangeIndex._difference has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
encoding._get_dummies_1d (cyclomatic 25) pandas/core/reshape/encoding.py:286— encoding._get_dummies_1d has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
datetimes.to_datetime (cyclomatic 25) pandas/core/tools/datetimes.py:849— datetimes.to_datetime has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
printing.format_object_summary (cyclomatic 25) pandas/io/formats/printing.py:408— printing.format_object_summary has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Styler.to_latex (cyclomatic 25) REDACTED:763— Styler.to_latex has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parquet._get_path_or_handle (cyclomatic 25) pandas/io/parquet.py:97— parquet._get_path_or_handle has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
datetimes.date_range (cyclomatic 24) pandas/core/indexes/datetimes.py:2523— datetimes.date_range has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultiIndex._get_level_indexer (cyclomatic 24) pandas/core/indexes/multi.py:4047— MultiIndex._get_level_indexer has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RangeIndex._concat (cyclomatic 24) pandas/core/indexes/range.py:1317— RangeIndex._concat has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_LocIndexer._convert_to_indexer (cyclomatic 24) pandas/core/indexing.py:2081— _LocIndexer._convert_to_indexer has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
construction.to_arrays (cyclomatic 24) pandas/core/internals/construction.py:789— construction.to_arrays has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tile._bins_to_cuts (cyclomatic 24) pandas/core/reshape/tile.py:473— tile._bins_to_cuts has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HTMLFormatter._write_col_header (cyclomatic 24) pandas/io/formats/html.py:291— HTMLFormatter._write_col_header has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
asserters.assert_extension_array_equal (cyclomatic 23) pandas/_testing/asserters.py:878— asserters.assert_extension_array_equal has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
IntervalArray._cmp_method (cyclomatic 23) pandas/core/arrays/interval.py:741— IntervalArray._cmp_method has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BinOp.convert_value (cyclomatic 23) pandas/core/computation/pytables.py:255— BinOp.convert_value has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowDtype.type (cyclomatic 23) pandas/core/dtypes/dtypes.py:2293— ArrowDtype.type has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
NDFrame.filter (cyclomatic 23) pandas/core/generic.py:5675— NDFrame.filter has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NDFrame.asof (cyclomatic 23) pandas/core/generic.py:8476— NDFrame.asof has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
base.get_values_for_csv (cyclomatic 23) pandas/core/indexes/base.py:8654— base.get_values_for_csv has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
indexing.infer_and_maybe_downcast (cyclomatic 23) pandas/core/indexing.py:4036— indexing.infer_and_maybe_downcast has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseBlockManager._slice_take_blocks_ax0 (cyclomatic 23) pandas/core/internals/managers.py:909— BaseBlockManager._slice_take_blocks_ax0 has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockManager.iset (cyclomatic 23) pandas/core/internals/managers.py:1305— BlockManager.iset has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MPLPlot.__init__ (cyclomatic 23) pandas/plotting/_matplotlib/core.py:152— MPLPlot.__init__ has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray.__getitem__ (cyclomatic 22) pandas/core/arrays/arrow/array.py:1126— ArrowExtensionArray.__getitem__ has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DatetimeLikeArrayMixin.__add__ (cyclomatic 22) pandas/core/arrays/datetimelike.py:1327— DatetimeLikeArrayMixin.__add__ has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DatetimeLikeArrayMixin.__sub__ (cyclomatic 22) pandas/core/arrays/datetimelike.py:1398— DatetimeLikeArrayMixin.__sub__ has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
datetimes._generate_range (cyclomatic 22) pandas/core/arrays/datetimes.py:3178— datetimes._generate_range has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SparseArray.__getitem__ (cyclomatic 22) pandas/core/arrays/sparse/array.py:1480— SparseArray.__getitem__ has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TimedeltaArray.__mul__ (cyclomatic 22) pandas/core/arrays/timedeltas.py:519— TimedeltaArray.__mul__ has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Index._maybe_downcast_for_indexing (cyclomatic 22) pandas/core/indexes/base.py:6689— Index._maybe_downcast_for_indexing has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RangeIndex._union (cyclomatic 22) pandas/core/indexes/range.py:1040— RangeIndex._union has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Block.replace_list (cyclomatic 22) pandas/core/internals/blocks.py:832— Block.replace_list has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
construction.dict_to_mgr (cyclomatic 22) pandas/core/internals/construction.py:402— construction.dict_to_mgr has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Parser._try_convert_to_date (cyclomatic 22) pandas/io/json/_json.py:1631— Parser._try_convert_to_date has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowParserWrapper._finalize_index (cyclomatic 22) pandas/io/parsers/arrow_parser_wrapper.py:429— ArrowParserWrapper._finalize_index has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HDFStore._create_storer (cyclomatic 22) pandas/io/pytables.py:2269— HDFStore._create_storer has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GenericFixed.write_array (cyclomatic 22) pandas/io/pytables.py:3929— GenericFixed.write_array has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BarPlot._make_plot (cyclomatic 22) pandas/plotting/_matplotlib/core.py:2180— BarPlot._make_plot has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
apply.reconstruct_func (cyclomatic 21) pandas/core/apply.py:2015— apply.reconstruct_func has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._box_pa_scalar (cyclomatic 21) pandas/core/arrays/arrow/array.py:885— ArrowExtensionArray._box_pa_scalar has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray.to_numpy (cyclomatic 21) pandas/core/arrays/arrow/array.py:2610— ArrowExtensionArray.to_numpy has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StringArray._cmp_method (cyclomatic 21) pandas/core/arrays/string_.py:1230— StringArray._cmp_method has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cast.infer_dtype_from_scalar (cyclomatic 21) pandas/core/dtypes/cast.py:701— cast.infer_dtype_from_scalar has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataFrame.__getitem__ (cyclomatic 21) pandas/core/frame.py:4306— DataFrame.__getitem__ has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataFrame.shift (cyclomatic 21) pandas/core/frame.py:7511— DataFrame.shift has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultiIndex._reorder_indexer (cyclomatic 21) pandas/core/indexes/multi.py:4511— MultiIndex._reorder_indexer has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_LocIndexer._getitem_axis (cyclomatic 21) pandas/core/indexing.py:1994— _LocIndexer._getitem_axis has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
datetimes._to_datetime_with_unit (cyclomatic 21) pandas/core/tools/datetimes.py:547— datetimes._to_datetime_with_unit has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HTMLFormatter._write_hierarchical_rows (cyclomatic 21) pandas/io/formats/html.py:495— HTMLFormatter._write_hierarchical_rows has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PythonParser._rows_to_cols (cyclomatic 21) pandas/io/parsers/python_parser.py:1221— PythonParser._rows_to_cols has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
IndexCol.convert (cyclomatic 21) pandas/io/pytables.py:2753— IndexCol.convert has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AppendableFrameTable.read (cyclomatic 21) pandas/io/pytables.py:5714— AppendableFrameTable.read has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_XMLFrameParser._parse_nodes (cyclomatic 21) REDACTED:199— _XMLFrameParser._parse_nodes has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_testing.shares_memory (cyclomatic 20) pandas/_testing/__init__.py:523— _testing.shares_memory has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
algorithms.diff (cyclomatic 20) pandas/core/algorithms.py:1586— algorithms.diff has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
NDFrame.xs (cyclomatic 20) pandas/core/generic.py:4194— NDFrame.xs has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_MergeOperation._get_merge_keys (cyclomatic 20) pandas/core/reshape/merge.py:1573— _MergeOperation._get_merge_keys has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pivot._add_margins (cyclomatic 20) pandas/core/reshape/pivot.py:429— pivot._add_margins has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
common.flex_binary_moment (cyclomatic 20) pandas/core/window/common.py:18— common.flex_binary_moment has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
clipboard.determine_clipboard (cyclomatic 20) pandas/io/clipboard/__init__.py:535— clipboard.determine_clipboard has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StylerRenderer._translate_latex (cyclomatic 20) REDACTED:929— StylerRenderer._translate_latex has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray._cmp_method (cyclomatic 19) pandas/core/arrays/arrow/array.py:1374— ArrowExtensionArray._cmp_method has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowExtensionArray.__setitem__ (cyclomatic 19) pandas/core/arrays/arrow/array.py:3340— ArrowExtensionArray.__setitem__ has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PeriodArray._from_sequence (cyclomatic 19) pandas/core/arrays/period.py:261— PeriodArray._from_sequence has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
missing.array_equivalent (cyclomatic 19) pandas/core/dtypes/missing.py:417— missing.array_equivalent has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
missing._array_equivalent_object (cyclomatic 19) pandas/core/dtypes/missing.py:531— missing._array_equivalent_object has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
missing.is_valid_na_for_dtype (cyclomatic 19) pandas/core/dtypes/missing.py:679— missing.is_valid_na_for_dtype has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataFrame.join (cyclomatic 19) pandas/core/frame.py:15764— DataFrame.join has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
GroupBy._value_counts (cyclomatic 19) pandas/core/groupby/groupby.py:2482— GroupBy._value_counts has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
base.maybe_sequence_to_range (cyclomatic 19) pandas/core/indexes/base.py:8332— base.maybe_sequence_to_range has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
BaseBlockManager.setitem (cyclomatic 19) pandas/core/internals/managers.py:566— BaseBlockManager.setitem has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
missing._interpolate_1d (cyclomatic 19) pandas/core/missing.py:505— missing._interpolate_1d has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
sorting.lexsort_indexer (cyclomatic 19) pandas/core/sorting.py:310— sorting.lexsort_indexer has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StringMethods.cat (cyclomatic 19) pandas/core/strings/accessor.py:494— StringMethods.cat has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ExcelFormatter._format_hierarchical_rows (cyclomatic 19) pandas/io/formats/excel.py:819— ExcelFormatter._format_hierarchical_rows has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
style._bar (cyclomatic 19) REDACTED:4442— style._bar has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_json._validate_pyarrow_engine_options (cyclomatic 19) pandas/io/json/_json.py:470— _json._validate_pyarrow_engine_options has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ParserBase._agg_index (cyclomatic 19) pandas/io/parsers/base_parser.py:380— ParserBase._agg_index has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
CParserWrapper.__init__ (cyclomatic 19) pandas/io/parsers/c_parser_wrapper.py:76— CParserWrapper.__init__ has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PythonParser._next_line (cyclomatic 19) pandas/io/parsers/python_parser.py:919— PythonParser._next_line has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Table.create_index (cyclomatic 19) pandas/io/pytables.py:4640— Table.create_index has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pytables._maybe_convert_for_string_atom (cyclomatic 19) pandas/io/pytables.py:6344— pytables._maybe_convert_for_string_atom has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tools.create_subplots (cyclomatic 19) pandas/plotting/_matplotlib/tools.py:142— tools.create_subplots has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
frequencies.is_subperiod (cyclomatic 19) pandas/tseries/frequencies.py:543— frequencies.is_subperiod has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (frequencies.is_superperiod) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
frequencies.is_superperiod (cyclomatic 19) pandas/tseries/frequencies.py:604— frequencies.is_superperiod has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (frequencies.is_subperiod) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
_utils.to_numpy_dtype_inference (cyclomatic 18) pandas/core/arrays/_utils.py:27— _utils.to_numpy_dtype_inference has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SparseArray._reduce (cyclomatic 18) pandas/core/arrays/sparse/array.py:2079— SparseArray._reduce has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
astype._astype_nansafe (cyclomatic 18) pandas/core/dtypes/astype.py:66— astype._astype_nansafe has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataFrame._set_item_frame_value (cyclomatic 18) pandas/core/frame.py:4815— DataFrame._set_item_frame_value has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataFrame.reset_index (cyclomatic 18) pandas/core/frame.py:8065— DataFrame.reset_index has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SeriesGroupBy.value_counts (cyclomatic 18) pandas/core/groupby/generic.py:1047— SeriesGroupBy.value_counts has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Index.get_indexer (cyclomatic 18) pandas/core/indexes/base.py:3871— Index.get_indexer has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Index._join_level (cyclomatic 18) pandas/core/indexes/base.py:4954— Index._join_level has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultiIndex._partial_tup_index (cyclomatic 18) pandas/core/indexes/multi.py:3570— MultiIndex._partial_tup_index has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_LocationIndexer._maybe_restore_dropped_levels (cyclomatic 18) pandas/core/indexing.py:936— _LocationIndexer._maybe_restore_dropped_levels has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_iLocIndexer._setitem_single_block (cyclomatic 18) pandas/core/indexing.py:3019— _iLocIndexer._setitem_single_block has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_iLocIndexer._align_frame (cyclomatic 18) pandas/core/indexing.py:3352— _iLocIndexer._align_frame has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ExtensionBlock._unwrap_setitem_indexer (cyclomatic 18) pandas/core/internals/blocks.py:2201— ExtensionBlock._unwrap_setitem_indexer has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
construction._extract_index (cyclomatic 18) pandas/core/internals/construction.py:635— construction._extract_index has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
encoding.from_dummies (cyclomatic 18) pandas/core/reshape/encoding.py:414— encoding.from_dummies has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
datetimes._adjust_to_origin (cyclomatic 18) pandas/core/tools/datetimes.py:686— datetimes._adjust_to_origin has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
style_render._get_level_lengths (cyclomatic 18) REDACTED:1856— style_render._get_level_lengths has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_HtmlFrameParser._expand_colspan_rowspan (cyclomatic 18) pandas/io/html.py:460— _HtmlFrameParser._expand_colspan_rowspan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PythonParser._convert_to_ndarrays (cyclomatic 18) pandas/io/parsers/python_parser.py:396— PythonParser._convert_to_ndarrays has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PythonParser._cast_types (cyclomatic 18) pandas/io/parsers/python_parser.py:484— PythonParser._cast_types has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PythonParser._get_lines (cyclomatic 18) pandas/io/parsers/python_parser.py:1308— PythonParser._get_lines has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
readers._read (cyclomatic 18) pandas/io/parsers/readers.py:362— readers._read has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
readers.read_fwf (cyclomatic 18) pandas/io/parsers/readers.py:2625— readers.read_fwf has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
readers._refine_defaults_read (cyclomatic 18) pandas/io/parsers/readers.py:3440— readers._refine_defaults_read has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
DataCol.convert (cyclomatic 18) pandas/io/pytables.py:3244— DataCol.convert has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SQLTable._sqlalchemy_type (cyclomatic 18) pandas/io/sql/base.py:675— SQLTable._sqlalchemy_type has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
tools.handle_shared_axes (cyclomatic 18) pandas/plotting/_matplotlib/tools.py:392— tools.handle_shared_axes has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
algorithms.map_array (cyclomatic 17) pandas/core/algorithms.py:1968— algorithms.map_array has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
take.take_2d_multi (cyclomatic 17) pandas/core/array_algos/take.py:183— take.take_2d_multi has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Categorical._maybe_convert_categories (cyclomatic 17) pandas/core/arrays/categorical.py:663— Categorical._maybe_convert_categories has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DatetimeLikeArrayMixin._cmp_method (cyclomatic 17) pandas/core/arrays/datetimelike.py:948— DatetimeLikeArrayMixin._cmp_method has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
array._sparse_array_op (cyclomatic 17) pandas/core/arrays/sparse/array.py:241— array._sparse_array_op has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parsing._split_by_backtick (cyclomatic 17) pandas/core/computation/parsing.py:166— parsing._split_by_backtick has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
IntervalDtype.__init__ (cyclomatic 17) pandas/core/dtypes/dtypes.py:1294— IntervalDtype.__init__ has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DataFrame.dropna (cyclomatic 17) pandas/core/frame.py:8644— DataFrame.dropna has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Index._cmp_method (cyclomatic 17) pandas/core/indexes/base.py:7799— Index._cmp_method has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultiIndex._verify_integrity (cyclomatic 17) pandas/core/indexes/multi.py:383— MultiIndex._verify_integrity has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_iLocIndexer._setitem_with_indexer_missing (cyclomatic 17) pandas/core/indexing.py:3106— _iLocIndexer._setitem_with_indexer_missing has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Block.where (cyclomatic 17) pandas/core/internals/blocks.py:1323— Block.where has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
concat._clean_keys_and_objs (cyclomatic 17) pandas/core/reshape/concat.py:817— concat._clean_keys_and_objs has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_MergeOperation._get_join_info (cyclomatic 17) pandas/core/reshape/merge.py:1429— _MergeOperation._get_join_info has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
reshape._stack_multi_columns (cyclomatic 17) pandas/core/reshape/reshape.py:833— reshape._stack_multi_columns has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BaseWindow._validate (cyclomatic 17) pandas/core/window/rolling.py:163— BaseWindow._validate has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OpenpyxlWriter._write_cells_write_only (cyclomatic 17) pandas/io/excel/_openpyxl.py:505— OpenpyxlWriter._write_cells_write_only has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
OpenpyxlWriter._write_cells_normal (cyclomatic 17) pandas/io/excel/_openpyxl.py:587— OpenpyxlWriter._write_cells_normal has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_XlsxStyler.convert (cyclomatic 17) pandas/io/excel/_xlsxwriter.py:98— _XlsxStyler.convert has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MPLPlot._parse_errorbars (cyclomatic 17) pandas/plotting/_matplotlib/core.py:1188— MPLPlot._parse_errorbars has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hist.hist_series (cyclomatic 17) pandas/plotting/_matplotlib/hist.py:489— hist.hist_series has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tools._get_layout (cyclomatic 17) pandas/plotting/_matplotlib/tools.py:91— tools._get_layout has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mean_.sliding_mean (cyclomatic 16) pandas/core/_numba/kernels/mean_.py:68— mean_.sliding_mean has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowStringArray._from_sequence (cyclomatic 16) pandas/core/arrays/string_arrow.py:231— ArrowStringArray._from_sequence has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
grouper._factorize_monotonic (cyclomatic 16) pandas/core/groupby/grouper.py:966— grouper._factorize_monotonic has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
DatetimeTimedeltaMixin._get_arithmetic_result_freq (cyclomatic 16) pandas/core/indexes/datetimelike.py:893— DatetimeTimedeltaMixin._get_arithmetic_result_freq has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MultiIndex.get_loc (cyclomatic 16) pandas/core/indexes/multi.py:3660— MultiIndex.get_loc has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
range._exact_int64_targets (cyclomatic 16) pandas/core/indexes/range.py:94— range._exact_int64_targets has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
_iLocIndexer._validate_key (cyclomatic 16) pandas/core/indexing.py:2345— _iLocIndexer._validate_key has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_iLocIndexer._decide_split_path (cyclomatic 16) pandas/core/indexing.py:2559— _iLocIndexer._decide_split_path has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
_iLocIndexer._setitem_new_column (cyclomatic 16) pandas/core/indexing.py:2620— _iLocIndexer._setitem_new_column has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
BlockManager.as_array (cyclomatic 16) pandas/core/internals/managers.py:1863— BlockManager.as_array has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
select.select (cyclomatic 16) pandas/core/methods/select.py:60— select.select has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
nanops._sum_timedelta_i8 (cyclomatic 16) pandas/core/nanops.py:869— nanops._sum_timedelta_i8 has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
array_ops.comparison_op (cyclomatic 16) pandas/core/ops/array_ops.py:346— array_ops.comparison_op has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
resample._adjust_dates_anchored (cyclomatic 16) pandas/core/resample.py:3135— resample._adjust_dates_anchored has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
pivot.pivot (cyclomatic 16) pandas/core/reshape/pivot.py:748— pivot.pivot has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
reshape.stack_v3 (cyclomatic 16) pandas/core/reshape/reshape.py:1002— reshape.stack_v3 has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
StringMethods.replace (cyclomatic 16) pandas/core/strings/accessor.py:1662— StringMethods.replace has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SeriesFormatter._get_footer (cyclomatic 16) pandas/io/formats/format.py:207— SeriesFormatter._get_footer has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
printing._pprint_seq (cyclomatic 16) pandas/io/formats/printing.py:116— printing._pprint_seq has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ArrowParserWrapper.read (cyclomatic 16) pandas/io/parsers/arrow_parser_wrapper.py:611— ArrowParserWrapper.read has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HDFStore.append_to_multiple (cyclomatic 16) pandas/io/pytables.py:1734— HDFStore.append_to_multiple has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pytables._convert_index (cyclomatic 16) pandas/io/pytables.py:6173— pytables._convert_index has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
XportReader._read_header (cyclomatic 16) pandas/io/sas/sas_xport.py:293— XportReader._read_header has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MPLPlot._adorn_subplots (cyclomatic 16) pandas/plotting/_matplotlib/core.py:829— MPLPlot._adorn_subplots has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cast.np_can_hold_element (cognitive 172) pandas/core/dtypes/cast.py:1709— cast.np_can_hold_element has cognitive complexity 172 (threshold 15). Drivers by points: if/else 51 (142 pts), ternaries 3 (13 pts), boolean chains 12, error handling 1 (5 pts) (nesting depth added 105). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MultiIndex._get_locs (cognitive 133) pandas/core/indexes/multi.py:4223— MultiIndex._get_locs has cognitive complexity 133 (threshold 15). Drivers by points: if/else 34 (100 pts), ternaries 2 (10 pts), loops 4 (9 pts), boolean chains 7, error handling 2 (7 pts) (nesting depth added 84). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MultiIndex._get_loc_level (cognitive 116) pandas/core/indexes/multi.py:3860— MultiIndex._get_loc_level has cognitive complexity 116 (threshold 15). Drivers by points: if/else 30 (85 pts), error handling 5 (14 pts), boolean chains 7, loops 3 (7 pts), ternaries 1 (3 pts) (nesting depth added 70). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PythonParser._infer_columns (cognitive 112) pandas/io/parsers/python_parser.py:618— PythonParser._infer_columns has cognitive complexity 112 (threshold 15). Drivers by points: if/else 29 (76 pts), ternaries 3 (13 pts), boolean chains 9, loops 3 (8 pts), error handling 2 (6 pts) (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_MergeOperation._maybe_add_join_keys (cognitive 108) pandas/core/reshape/merge.py:1277— _MergeOperation._maybe_add_join_keys has cognitive complexity 108 (threshold 15). Drivers by points: if/else 26 (77 pts), ternaries 4 (20 pts), boolean chains 10, loops 1 (nesting depth added 67). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NDFrame._where (cognitive 101) pandas/core/generic.py:10411— NDFrame._where has cognitive complexity 101 (threshold 15). Drivers by points: if/else 41 (87 pts), boolean chains 9, loops 1 (4 pts), ternaries 1 (nesting depth added 49). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
readers._read_csv_chunks (cognitive 101) pandas/io/parsers/readers.py:840— readers._read_csv_chunks has cognitive complexity 101 (threshold 15). Drivers by points: if/else 36 (50 pts), loops 13 (24 pts), boolean chains 13, error handling 4 (8 pts), ternaries 5 (6 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_XMLFrameParser._iterparse_nodes (cognitive 95) REDACTED:285— _XMLFrameParser._iterparse_nodes has cognitive complexity 95 (threshold 15). Drivers by points: if/else 21 (57 pts), ternaries 5 (16 pts), loops 4 (14 pts), boolean chains 8 (nesting depth added 57). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_MergeOperation._maybe_coerce_merge_keys (cognitive 92) pandas/core/reshape/merge.py:1700— _MergeOperation._maybe_coerce_merge_keys has cognitive complexity 92 (threshold 15). Drivers by points: if/else 19 (53 pts), boolean chains 29, ternaries 3 (9 pts), loops 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HTMLFormatter._write_col_header (cognitive 89) pandas/io/formats/html.py:291— HTMLFormatter._write_col_header has cognitive complexity 89 (threshold 15). Drivers by points: if/else 25 (72 pts), loops 4 (15 pts), boolean chains 2 (nesting depth added 58). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cast.convert_dtypes (cognitive 88) pandas/core/dtypes/cast.py:894— cast.convert_dtypes has cognitive complexity 88 (threshold 15). Drivers by points: if/else 30 (65 pts), boolean chains 23 (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NDFrame.fillna (cognitive 78) pandas/core/generic.py:7277— NDFrame.fillna has cognitive complexity 78 (threshold 15). Drivers by points: if/else 27 (60 pts), loops 2 (8 pts), ternaries 2 (6 pts), boolean chains 4 (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
StringMethods._wrap_result (cognitive 77) pandas/core/strings/accessor.py:261— StringMethods._wrap_result has cognitive complexity 77 (threshold 15). Drivers by points: if/else 27 (56 pts), ternaries 3 (13 pts), boolean chains 5, loops 1 (3 pts) (nesting depth added 41). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Table._create_axes (cognitive 77) pandas/io/pytables.py:4821— Table._create_axes has cognitive complexity 77 (threshold 15). Drivers by points: if/else 33 (54 pts), boolean chains 14, ternaries 2 (4 pts), error handling 1 (3 pts), loops 2 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
eval.eval (cognitive 75) pandas/core/computation/eval.py:205— eval.eval has cognitive complexity 75 (threshold 15). Drivers by points: if/else 24 (48 pts), boolean chains 13, error handling 2 (7 pts), loops 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame.replace (cognitive 74) pandas/core/generic.py:7733— NDFrame.replace has cognitive complexity 74 (threshold 15). Drivers by points: if/else 30 (61 pts), boolean chains 7, loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 35). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DatetimeArray._generate_range (cognitive 73) pandas/core/arrays/datetimes.py:399— DatetimeArray._generate_range has cognitive complexity 73 (threshold 15). Drivers by points: if/else 29 (50 pts), boolean chains 10, ternaries 5 (10 pts), error handling 1 (3 pts) (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
grouper.get_grouper (cognitive 70) pandas/core/groupby/grouper.py:745— grouper.get_grouper has cognitive complexity 70 (threshold 15). Drivers by points: if/else 30 (58 pts), boolean chains 9, ternaries 1 (2 pts), loops 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stata._cast_to_stata_types (cognitive 70) pandas/io/stata.py:451— stata._cast_to_stata_types has cognitive complexity 70 (threshold 15). Drivers by points: if/else 19 (54 pts), boolean chains 10, loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._box_pa_array (cognitive 69) pandas/core/arrays/arrow/array.py:957— ArrowExtensionArray._box_pa_array has cognitive complexity 69 (threshold 15). Drivers by points: if/else 24 (47 pts), boolean chains 13, error handling 3 (9 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame._reduce (cognitive 69) pandas/core/frame.py:17063— DataFrame._reduce has cognitive complexity 69 (threshold 15). Drivers by points: if/else 18 (51 pts), boolean chains 11, error handling 1 (4 pts), ternaries 2 (3 pts) (nesting depth added 37). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
common.flex_binary_moment (cognitive 69) pandas/core/window/common.py:18— common.flex_binary_moment has cognitive complexity 69 (threshold 15). Drivers by points: if/else 16 (47 pts), loops 4 (19 pts), boolean chains 3 (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DataFrame.from_records (cognitive 65) pandas/core/frame.py:2075— DataFrame.from_records has cognitive complexity 65 (threshold 15). Drivers by points: if/else 31 (51 pts), loops 2 (6 pts), error handling 2 (5 pts), boolean chains 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
common.get_handle (cognitive 65) REDACTED:769— common.get_handle has cognitive complexity 65 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 12, loops 2 (5 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HTMLFormatter._write_hierarchical_rows (cognitive 65) pandas/io/formats/html.py:495— HTMLFormatter._write_hierarchical_rows has cognitive complexity 65 (threshold 15). Drivers by points: if/else 15 (47 pts), loops 6 (17 pts), boolean chains 1 (nesting depth added 43). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
numeric._coerce_to_data_and_mask (cognitive 64) pandas/core/arrays/numeric.py:137— numeric._coerce_to_data_and_mask has cognitive complexity 64 (threshold 15). Drivers by points: if/else 34 (57 pts), boolean chains 7 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.__init__ (cognitive 64) pandas/core/frame.py:472— DataFrame.__init__ has cognitive complexity 64 (threshold 15). Drivers by points: if/else 30 (50 pts), ternaries 4 (9 pts), boolean chains 5 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
numeric.to_numeric (cognitive 64) pandas/core/tools/numeric.py:52— numeric.to_numeric has cognitive complexity 64 (threshold 15). Drivers by points: if/else 27 (44 pts), boolean chains 13, error handling 1 (4 pts), loops 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PlotAccessor.__call__ (cognitive 64) pandas/plotting/_core.py:1131— PlotAccessor.__call__ has cognitive complexity 64 (threshold 15). Drivers by points: if/else 18 (41 pts), boolean chains 12, error handling 1 (5 pts), loops 1 (3 pts), ternaries 1 (3 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Series.__init__ (cognitive 63) pandas/core/series.py:365— Series.__init__ has cognitive complexity 63 (threshold 15). Drivers by points: if/else 33 (54 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index.join (cognitive 61) pandas/core/indexes/base.py:4590— Index.join has cognitive complexity 61 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 17, ternaries 4 (12 pts), error handling 3 (8 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
construction.ndarray_to_mgr (cognitive 61) pandas/core/internals/construction.py:215— construction.ndarray_to_mgr has cognitive complexity 61 (threshold 15). Drivers by points: if/else 28 (42 pts), boolean chains 13, ternaries 2 (6 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pivot.__internal_pivot_table (cognitive 60) pandas/core/reshape/pivot.py:293— pivot.__internal_pivot_table has cognitive complexity 60 (threshold 15). Drivers by points: if/else 24 (38 pts), boolean chains 8, loops 4 (8 pts), error handling 2 (6 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextFileReader._clean_options (cognitive 60) pandas/io/parsers/readers.py:2925— TextFileReader._clean_options has cognitive complexity 60 (threshold 15). Drivers by points: if/else 28 (43 pts), boolean chains 8, loops 3 (6 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
asserters.assert_series_equal (cognitive 59) pandas/_testing/asserters.py:1039— asserters.assert_series_equal has cognitive complexity 59 (threshold 15). Drivers by points: if/else 21 (29 pts), boolean chains 16, ternaries 6 (14 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
construction.array (cognitive 59) pandas/core/construction.py:86— construction.array has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (45 pts), boolean chains 11, error handling 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
WrappedCythonOp._call_cython_op (cognitive 59) pandas/core/groupby/ops.py:389— WrappedCythonOp._call_cython_op has cognitive complexity 59 (threshold 15). Drivers by points: if/else 28 (51 pts), boolean chains 5, ternaries 1 (3 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_MergeOperation._get_merge_keys (cognitive 59) pandas/core/reshape/merge.py:1573— _MergeOperation._get_merge_keys has cognitive complexity 59 (threshold 15). Drivers by points: if/else 22 (51 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ArrowExtensionArray._evaluate_op_method (cognitive 58) pandas/core/arrays/arrow/array.py:1462— ArrowExtensionArray._evaluate_op_method has cognitive complexity 58 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 15, error handling 4 (7 pts) (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
concat._make_concat_multiindex (cognitive 58) pandas/core/reshape/concat.py:933— concat._make_concat_multiindex has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (39 pts), boolean chains 7, loops 3 (7 pts), ternaries 1 (5 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_util._post_convert_dtypes (cognitive 58) pandas/io/_util.py:167— _util._post_convert_dtypes has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 4 (10 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StataReader.read (cognitive 57) pandas/io/stata.py:1663— StataReader.read has cognitive complexity 57 (threshold 15). Drivers by points: if/else 32 (47 pts), loops 5 (8 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseExcelReader._parse_sheet (cognitive 56) pandas/io/excel/_base.py:843— BaseExcelReader._parse_sheet has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (36 pts), loops 4 (12 pts), boolean chains 6, error handling 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowParserWrapper._get_pyarrow_options (cognitive 56) pandas/io/parsers/arrow_parser_wrapper.py:182— ArrowParserWrapper._get_pyarrow_options has cognitive complexity 56 (threshold 15). Drivers by points: if/else 22 (42 pts), boolean chains 10, loops 2 (4 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
melt.melt (cognitive 54) pandas/core/reshape/melt.py:48— melt.melt has cognitive complexity 54 (threshold 15). Drivers by points: if/else 30 (46 pts), boolean chains 3, ternaries 1 (3 pts), loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
datetimes._assemble_from_unit_mappings (cognitive 54) pandas/core/tools/datetimes.py:1356— datetimes._assemble_from_unit_mappings has cognitive complexity 54 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 7, error handling 2 (5 pts), loops 4 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PythonParser._get_lines (cognitive 54) pandas/io/parsers/python_parser.py:1308— PythonParser._get_lines has cognitive complexity 54 (threshold 15). Drivers by points: if/else 19 (39 pts), loops 2 (8 pts), ternaries 1 (4 pts), error handling 1 (3 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_iLocIndexer._align_series (cognitive 53) pandas/core/indexing.py:3236— _iLocIndexer._align_series has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (42 pts), boolean chains 9, loops 1 (2 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BaseBlockManager._slice_take_blocks_ax0 (cognitive 53) pandas/core/internals/managers.py:909— BaseBlockManager._slice_take_blocks_ax0 has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 5 (17 pts), boolean chains 5 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
merge._factorize_keys (cognitive 52) pandas/core/reshape/merge.py:2873— merge._factorize_keys has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (39 pts), boolean chains 10, ternaries 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_json.to_json (cognitive 51) pandas/io/json/_json.py:158— _json.to_json has cognitive complexity 51 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 7, loops 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
api.union_indexes (cognitive 50) pandas/core/indexes/api.py:203— api.union_indexes has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (40 pts), ternaries 2 (5 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tools.handle_shared_axes (cognitive 50) pandas/plotting/_matplotlib/tools.py:392— tools.handle_shared_axes has cognitive complexity 50 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 4 (13 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Categorical.__init__ (cognitive 49) pandas/core/arrays/categorical.py:400— Categorical.__init__ has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (42 pts), boolean chains 4, error handling 1 (3 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowParserWrapper._finalize_index (cognitive 49) pandas/io/parsers/arrow_parser_wrapper.py:429— ArrowParserWrapper._finalize_index has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (33 pts), ternaries 2 (7 pts), loops 2 (5 pts), boolean chains 4 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
ParserBase._infer_types (cognitive 49) pandas/io/parsers/base_parser.py:526— ParserBase._infer_types has cognitive complexity 49 (threshold 15). Drivers by points: if/else 21 (41 pts), boolean chains 6, error handling 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
interval.interval_range (cognitive 48) pandas/core/indexes/interval.py:1696— interval.interval_range has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (38 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
datetimes._to_datetime_with_unit (cognitive 48) pandas/core/tools/datetimes.py:547— datetimes._to_datetime_with_unit has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (41 pts), error handling 2 (5 pts), ternaries 1 (2 pts) (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PythonParser._rows_to_cols (cognitive 48) pandas/io/parsers/python_parser.py:1221— PythonParser._rows_to_cols has cognitive complexity 48 (threshold 15). Drivers by points: if/else 14 (39 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 28). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
readers._can_parallelize_csv (cognitive 48) pandas/io/parsers/readers.py:483— readers._can_parallelize_csv has cognitive complexity 48 (threshold 15). Drivers by points: if/else 29 (32 pts), boolean chains 8, error handling 3 (5 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
SparseArray.__init__ (cognitive 47) pandas/core/arrays/sparse/array.py:652— SparseArray.__init__ has cognitive complexity 47 (threshold 15). Drivers by points: if/else 26 (39 pts), boolean chains 3, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame._reduce_axis1 (cognitive 47) pandas/core/frame.py:17244— DataFrame._reduce_axis1 has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 6, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
to_dict.to_dict (cognitive 47) pandas/core/methods/to_dict.py:101— to_dict.to_dict has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (22 pts), ternaries 6 (13 pts), loops 2 (9 pts), boolean chains 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
algorithms.isin (cognitive 46) pandas/core/algorithms.py:549— algorithms.isin has cognitive complexity 46 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 13 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
construction.dict_to_mgr (cognitive 46) pandas/core/internals/construction.py:402— construction.dict_to_mgr has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 4 (10 pts), boolean chains 6, loops 2 (5 pts), error handling 1 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExcelFormatter._format_hierarchical_rows (cognitive 46) pandas/io/formats/excel.py:819— ExcelFormatter._format_hierarchical_rows has cognitive complexity 46 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 5 (17 pts), boolean chains 4 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_table_schema.parse_table_schema (cognitive 46) pandas/io/json/_table_schema.py:357— _table_schema.parse_table_schema has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (30 pts), ternaries 2 (7 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HDFStore._create_storer (cognitive 46) pandas/io/pytables.py:2269— HDFStore._create_storer has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (41 pts), error handling 2 (3 pts), boolean chains 2 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
min_max_.sliding_min_max (cognitive 45) pandas/core/_numba/kernels/min_max_.py:39— min_max_.sliding_min_max has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 6 (15 pts), boolean chains 9, ternaries 1 (2 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
algorithms.safe_sort (cognitive 45) pandas/core/algorithms.py:1707— algorithms.safe_sort has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 8, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RangeIndex._concat (cognitive 45) pandas/core/indexes/range.py:1317— RangeIndex._concat has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (37 pts), boolean chains 4, loops 2, ternaries 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
arraylike.array_ufunc (cognitive 44) pandas/core/arraylike.py:278— arraylike.array_ufunc has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (21 pts), loops 3 (8 pts), ternaries 3 (8 pts), boolean chains 7 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SparseArray.__getitem__ (cognitive 44) pandas/core/arrays/sparse/array.py:1480— SparseArray.__getitem__ has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (36 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
construction.sanitize_array (cognitive 44) pandas/core/construction.py:617— construction.sanitize_array has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 9 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cast._maybe_promote (cognitive 44) pandas/core/dtypes/cast.py:539— cast._maybe_promote has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (37 pts), error handling 2 (5 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
construction.to_arrays (cognitive 44) pandas/core/internals/construction.py:789— construction.to_arrays has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (34 pts), boolean chains 5, loops 1 (5 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
datetimes.to_datetime (cognitive 44) pandas/core/tools/datetimes.py:849— datetimes.to_datetime has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (38 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parquet._get_path_or_handle (cognitive 44) pandas/io/parquet.py:97— parquet._get_path_or_handle has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (27 pts), error handling 3 (9 pts), boolean chains 8 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
asserters.assert_index_equal (cognitive 43) pandas/_testing/asserters.py:219— asserters.assert_index_equal has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (26 pts), error handling 2 (6 pts), boolean chains 5, ternaries 2 (4 pts), loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiIndex._get_level_indexer (cognitive 43) pandas/core/indexes/multi.py:4047— MultiIndex._get_level_indexer has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 5, ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_LocIndexer._getitem_axis (cognitive 43) pandas/core/indexing.py:1994— _LocIndexer._getitem_axis has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (29 pts), error handling 1 (6 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_MergeOperation._validate_left_right_on (cognitive 43) pandas/core/reshape/merge.py:1890— _MergeOperation._validate_left_right_on has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (35 pts), boolean chains 8 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenpyxlWriter._write_cells_normal (cognitive 43) pandas/io/excel/_openpyxl.py:587— OpenpyxlWriter._write_cells_normal has cognitive complexity 43 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 5 (19 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.reset_index (cognitive 42) pandas/core/frame.py:8065— DataFrame.reset_index has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (33 pts), ternaries 2 (6 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Index.__new__ (cognitive 42) pandas/core/indexes/base.py:499— Index.__new__ has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 6, error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
base.get_values_for_csv (cognitive 42) pandas/core/indexes/base.py:8654— base.get_values_for_csv has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_LocIndexer._convert_to_indexer (cognitive 42) pandas/core/indexing.py:2081— _LocIndexer._convert_to_indexer has cognitive complexity 42 (threshold 15). Drivers by points: if/else 15 (29 pts), error handling 4 (8 pts), boolean chains 5 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser._try_convert_data (cognitive 42) pandas/io/json/_json.py:1538— Parser._try_convert_data has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (21 pts), error handling 5 (12 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PythonParser._next_line (cognitive 42) pandas/io/parsers/python_parser.py:919— PythonParser._next_line has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 4 (8 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
apply.reconstruct_func (cognitive 41) pandas/core/apply.py:2015— apply.reconstruct_func has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 8, loops 2 (5 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timedeltas.sequence_to_td64ns (cognitive 41) pandas/core/arrays/timedeltas.py:1223— timedeltas.sequence_to_td64ns has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cast.maybe_downcast_numeric (cognitive 41) pandas/core/dtypes/cast.py:315— cast.maybe_downcast_numeric has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 6, error handling 1 (3 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_AsOfMerge._validate_left_right_on (cognitive 41) pandas/core/reshape/merge.py:2474— _AsOfMerge._validate_left_right_on has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21 (27 pts), boolean chains 8, ternaries 2 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._from_sequence_of_strings (cognitive 40) pandas/core/arrays/arrow/array.py:614— ArrowExtensionArray._from_sequence_of_strings has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
datetimes._generate_range (cognitive 40) pandas/core/arrays/datetimes.py:3178— datetimes._generate_range has cognitive complexity 40 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 2 (4 pts), boolean chains 3, ternaries 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.join (cognitive 40) pandas/core/frame.py:15764— DataFrame.join has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (29 pts), ternaries 3 (8 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DatetimeIndexOpsMixin.equals (cognitive 40) pandas/core/indexes/datetimelike.py:308— DatetimeIndexOpsMixin.equals has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (22 pts), error handling 4 (14 pts), boolean chains 4 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
printing.format_object_summary (cognitive 40) pandas/io/formats/printing.py:408— printing.format_object_summary has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (27 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser._try_convert_to_date (cognitive 40) pandas/io/json/_json.py:1631— Parser._try_convert_to_date has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 4 (10 pts), boolean chains 5, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PythonParser._convert_to_ndarrays (cognitive 40) pandas/io/parsers/python_parser.py:396— PythonParser._convert_to_ndarrays has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 5, error handling 1 (3 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BarPlot._make_plot (cognitive 40) pandas/plotting/_matplotlib/core.py:2180— BarPlot._make_plot has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.shift (cognitive 39) pandas/core/frame.py:7511— DataFrame.shift has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 3 (10 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockManager.iset (cognitive 39) pandas/core/internals/managers.py:1305— BlockManager.iset has cognitive complexity 39 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
common._get_filepath_or_buffer (cognitive 39) REDACTED:331— common._get_filepath_or_buffer has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 11, error handling 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_HtmlFrameParser._expand_colspan_rowspan (cognitive 39) pandas/io/html.py:460— _HtmlFrameParser._expand_colspan_rowspan has cognitive complexity 39 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 7 (16 pts), boolean chains 3, ternaries 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppendableFrameTable.read (cognitive 39) pandas/io/pytables.py:5714— AppendableFrameTable.read has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 3, error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tools.create_subplots (cognitive 39) pandas/plotting/_matplotlib/tools.py:142— tools.create_subplots has cognitive complexity 39 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RangeIndex._union (cognitive 38) pandas/core/indexes/range.py:1040— RangeIndex._union has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (31 pts), boolean chains 7 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
concat.concat (cognitive 38) pandas/core/reshape/concat.py:163— concat.concat has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (22 pts), ternaries 4 (9 pts), boolean chains 7 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
merge.get_join_indexers (cognitive 38) pandas/core/reshape/merge.py:2062— merge.get_join_indexers has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 11 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Styler.to_latex (cognitive 38) REDACTED:763— Styler.to_latex has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 6 (14 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StylerRenderer._translate_latex (cognitive 38) REDACTED:929— StylerRenderer._translate_latex has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 3 (6 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParserBase._agg_index (cognitive 38) pandas/io/parsers/base_parser.py:380— ParserBase._agg_index has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 5, ternaries 1 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._reduce_pyarrow (cognitive 37) pandas/core/arrays/arrow/array.py:2941— ArrowExtensionArray._reduce_pyarrow has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 14, error handling 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NDFrame.asof (cognitive 37) pandas/core/generic.py:8476— NDFrame.asof has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (29 pts), ternaries 3 (4 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
datetimes._convert_listlike_datetimes (cognitive 37) pandas/core/tools/datetimes.py:370— datetimes._convert_listlike_datetimes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 2, error handling 2, ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_normalize.json_normalize (cognitive 37) pandas/io/json/_normalize.py:320— _normalize.json_normalize has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (26 pts), loops 3 (6 pts), boolean chains 4, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._cast_pointwise_result (cognitive 36) pandas/core/arrays/arrow/array.py:763— ArrowExtensionArray._cast_pointwise_result has cognitive complexity 36 (threshold 15). Drivers by points: error handling 7 (15 pts), if/else 9 (13 pts), boolean chains 8 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._groupby_op_pyarrow (cognitive 36) pandas/core/arrays/arrow/array.py:3900— ArrowExtensionArray._groupby_op_pyarrow has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 9, error handling 2 (5 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NDFrame.to_latex (cognitive 36) pandas/core/generic.py:3455— NDFrame.to_latex has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (24 pts), ternaries 6, boolean chains 4, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Block.replace_list (cognitive 36) pandas/core/internals/blocks.py:832— Block.replace_list has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4 (8 pts), boolean chains 7 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimeGrouper.__init__ (cognitive 36) pandas/core/resample.py:2459— TimeGrouper.__init__ has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 5, error handling 2 (3 pts), ternaries 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
encoding._get_dummies_1d (cognitive 36) pandas/core/reshape/encoding.py:286— encoding._get_dummies_1d has cognitive complexity 36 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sorting.lexsort_indexer (cognitive 36) pandas/core/sorting.py:310— sorting.lexsort_indexer has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (28 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
datetimes._adjust_to_origin (cognitive 36) pandas/core/tools/datetimes.py:686— datetimes._adjust_to_origin has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (24 pts), error handling 4 (8 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
html._data_to_frame (cognitive 36) pandas/io/html.py:869— html._data_to_frame has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 1 (6 pts), boolean chains 1 (nesting depth added 24). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MPLPlot._adorn_subplots (cognitive 36) pandas/plotting/_matplotlib/core.py:829— MPLPlot._adorn_subplots has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (31 pts), loops 2 (5 pts) (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DatetimeLikeArrayMixin._validate_listlike (cognitive 35) pandas/core/arrays/datetimelike.py:616— DatetimeLikeArrayMixin._validate_listlike has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 9, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame._align_for_op (cognitive 35) pandas/core/frame.py:10396— DataFrame._align_for_op has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame.filter (cognitive 35) pandas/core/generic.py:5675— NDFrame.filter has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (26 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_iLocIndexer._setitem_with_indexer_missing (cognitive 35) pandas/core/indexing.py:3106— _iLocIndexer._setitem_with_indexer_missing has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (35 pts) (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_utils.to_numpy_dtype_inference (cognitive 34) pandas/core/arrays/_utils.py:27— _utils.to_numpy_dtype_inference has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._cmp_method (cognitive 34) pandas/core/arrays/arrow/array.py:1374— ArrowExtensionArray._cmp_method has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 4 (12 pts), boolean chains 7 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.apply (cognitive 34) pandas/core/frame.py:15261— DataFrame.apply has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (30 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame.clip (cognitive 34) pandas/core/generic.py:8998— NDFrame.clip has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
datetimes.date_range (cognitive 34) pandas/core/indexes/datetimes.py:2523— datetimes.date_range has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 6 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_iLocIndexer._align_frame (cognitive 34) pandas/core/indexing.py:3352— _iLocIndexer._align_frame has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
select.select (cognitive 34) pandas/core/methods/select.py:60— select.select has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Table.create_index (cognitive 34) pandas/io/pytables.py:4640— Table.create_index has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseMaskedArray._arith_method (cognitive 33) pandas/core/arrays/masked.py:1000— BaseMaskedArray._arith_method has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 6 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StringArray._cmp_method (cognitive 33) pandas/core/arrays/string_.py:1230— StringArray._cmp_method has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 6 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimedeltaArray.__mul__ (cognitive 33) pandas/core/arrays/timedeltas.py:519— TimedeltaArray.__mul__ has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IntervalDtype.__init__ (cognitive 33) pandas/core/dtypes/dtypes.py:1294— IntervalDtype.__init__ has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
GroupBy._value_counts (cognitive 33) pandas/core/groupby/groupby.py:2482— GroupBy._value_counts has cognitive complexity 33 (threshold 15). Drivers by points: if/else 16 (26 pts), ternaries 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseBlockManager.setitem (cognitive 33) pandas/core/internals/managers.py:566— BaseBlockManager.setitem has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 6, ternaries 1 (5 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
style_render._get_level_lengths (cognitive 33) REDACTED:1856— style_render._get_level_lengths has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame._set_item_frame_value (cognitive 32) pandas/core/frame.py:4815— DataFrame._set_item_frame_value has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 4, loops 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame.__setstate__ (cognitive 32) pandas/core/generic.py:2060— NDFrame.__setstate__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (6 pts), boolean chains 2 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
NDFrame.xs (cognitive 32) pandas/core/generic.py:4194— NDFrame.xs has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CParserWrapper._read_arrays (cognitive 32) pandas/io/parsers/c_parser_wrapper.py:281— CParserWrapper._read_arrays has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 1 (4 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readers.read_fwf (cognitive 32) pandas/io/parsers/readers.py:2625— readers.read_fwf has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
StataReader._do_convert_missing (cognitive 32) pandas/io/stata.py:1846— StataReader._do_convert_missing has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StataReader._do_convert_categoricals (cognitive 32) pandas/io/stata.py:1951— StataReader._do_convert_categoricals has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 2 (5 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_XMLFrameParser._parse_nodes (cognitive 32) REDACTED:199— _XMLFrameParser._parse_nodes has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 10 (21 pts), if/else 6 (7 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MPLPlot.__init__ (cognitive 32) pandas/plotting/_matplotlib/core.py:152— MPLPlot.__init__ has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (25 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
asserters.assert_extension_array_equal (cognitive 31) pandas/_testing/asserters.py:878— asserters.assert_extension_array_equal has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 9, ternaries 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
boolean.coerce_to_array (cognitive 31) pandas/core/arrays/boolean.py:183— boolean.coerce_to_array has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_LocationIndexer._post_expansion_casting (cognitive 31) pandas/core/indexing.py:1103— _LocationIndexer._post_expansion_casting has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 2 (6 pts), boolean chains 1 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_iLocIndexer._setitem_single_block (cognitive 31) pandas/core/indexing.py:3019— _iLocIndexer._setitem_single_block has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 7 (nesting depth added 14). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
encoding.from_dummies (cognitive 31) pandas/core/reshape/encoding.py:414— encoding.from_dummies has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (28 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clipboard.determine_clipboard (cognitive 31) pandas/io/clipboard/__init__.py:535— clipboard.determine_clipboard has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (16 pts), error handling 4 (11 pts), boolean chains 4 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
algorithms.map_array (cognitive 30) pandas/core/algorithms.py:1968— algorithms.map_array has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 3 (12 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Categorical._maybe_convert_categories (cognitive 30) pandas/core/arrays/categorical.py:663— Categorical._maybe_convert_categories has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, ternaries 1 (3 pts), error handling 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
IntervalArray._ensure_simple_new_inputs (cognitive 30) pandas/core/arrays/interval.py:293— IntervalArray._ensure_simple_new_inputs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 10 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
missing._array_equivalent_object (cognitive 30) pandas/core/dtypes/missing.py:531— missing._array_equivalent_object has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (18 pts), error handling 3 (7 pts), boolean chains 4, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseGrouper._reduceat_aggregate (cognitive 30) pandas/core/groupby/ops.py:1087— BaseGrouper._reduceat_aggregate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 19 (24 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Index._join_level (cognitive 30) pandas/core/indexes/base.py:4954— Index._join_level has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index.get_slice_bound (cognitive 30) pandas/core/indexes/base.py:7268— Index.get_slice_bound has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 4 (9 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pivot._add_margins (cognitive 30) pandas/core/reshape/pivot.py:429— pivot._add_margins has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (23 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
OpenpyxlWriter._write_cells_write_only (cognitive 30) pandas/io/excel/_openpyxl.py:505— OpenpyxlWriter._write_cells_write_only has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (10 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Tooltips._translate (cognitive 30) REDACTED:2350— Tooltips._translate has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (12 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
converter._daily_finder (cognitive 30) pandas/plotting/_matplotlib/converter.py:698— converter._daily_finder has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (30 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IntervalArray._cmp_method (cognitive 29) pandas/core/arrays/interval.py:741— IntervalArray._cmp_method has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (25 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.__getitem__ (cognitive 29) pandas/core/frame.py:4306— DataFrame.__getitem__ has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 4, error handling 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiIndex._partial_tup_index (cognitive 29) pandas/core/indexes/multi.py:3570— MultiIndex._partial_tup_index has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 5, error handling 1 (3 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
construction._homogenize (cognitive 29) pandas/core/internals/construction.py:583— construction._homogenize has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_AsOfMerge._get_join_indexers (cognitive 29) pandas/core/reshape/merge.py:2662— _AsOfMerge._get_join_indexers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 4, ternaries 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tile._bins_to_cuts (cognitive 29) pandas/core/reshape/tile.py:473— tile._bins_to_cuts has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ODFReader.get_sheet_data (cognitive 29) pandas/io/excel/_odfreader.py:108— ODFReader.get_sheet_data has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataCol.convert (cognitive 29) pandas/io/pytables.py:3244— DataCol.convert has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (22 pts), error handling 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sum_.sliding_sum (cognitive 28) pandas/core/_numba/kernels/sum_.py:66— sum_.sliding_sum has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 4 (10 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
algorithms.diff (cognitive 28) pandas/core/algorithms.py:1586— algorithms.diff has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), ternaries 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray.to_numpy (cognitive 28) pandas/core/arrays/arrow/array.py:2610— ArrowExtensionArray.to_numpy has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 8 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
align._align_core (cognitive 28) pandas/core/computation/align.py:90— align._align_core has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (6 pts), ternaries 1 (4 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parsing._split_by_backtick (cognitive 28) pandas/core/computation/parsing.py:166— parsing._split_by_backtick has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 1 (4 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BinOp.convert_value (cognitive 28) pandas/core/computation/pytables.py:255— BinOp.convert_value has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 5, error handling 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame.astype (cognitive 28) pandas/core/generic.py:6637— NDFrame.astype has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), error handling 1 (4 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utils.check_setitem_lengths (cognitive 28) pandas/core/indexers/utils.py:125— utils.check_setitem_lengths has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (25 pts), boolean chains 3 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MultiIndex._reorder_indexer (cognitive 28) pandas/core/indexes/multi.py:4511— MultiIndex._reorder_indexer has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RangeIndex._difference (cognitive 28) pandas/core/indexes/range.py:1115— RangeIndex._difference has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 5, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
indexing.infer_and_maybe_downcast (cognitive 28) pandas/core/indexing.py:4036— indexing.infer_and_maybe_downcast has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 7, error handling 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pivot._generate_marginal_results (cognitive 28) pandas/core/reshape/pivot.py:568— pivot._generate_marginal_results has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 2 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pivot.pivot (cognitive 28) pandas/core/reshape/pivot.py:748— pivot.pivot has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (22 pts), ternaries 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reshape._stack_multi_columns (cognitive 28) pandas/core/reshape/reshape.py:833— reshape._stack_multi_columns has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_XlsxStyler.convert (cognitive 28) pandas/io/excel/_xlsxwriter.py:98— _XlsxStyler.convert has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 2 (7 pts), loops 4 (7 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PythonParser._handle_usecols (cognitive 28) pandas/io/parsers/python_parser.py:794— PythonParser._handle_usecols has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), error handling 1 (5 pts), loops 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IndexCol.convert (cognitive 28) pandas/io/pytables.py:2753— IndexCol.convert has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 5, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenericFixed.write_array (cognitive 28) pandas/io/pytables.py:3929— GenericFixed.write_array has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SAS7BDATReader._read_amd_column_text (cognitive 28) pandas/io/sas/sas7bdat.py:933— SAS7BDATReader._read_amd_column_text has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DatetimeLikeArrayMixin._cmp_method (cognitive 27) pandas/core/arrays/datetimelike.py:948— DatetimeLikeArrayMixin._cmp_method has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (19 pts), error handling 2 (5 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseMaskedArray.fillna (cognitive 27) pandas/core/arrays/masked.py:335— BaseMaskedArray.fillna has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (20 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SparseArray._reduce (cognitive 27) pandas/core/arrays/sparse/array.py:2079— SparseArray._reduce has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame._drop_axis (cognitive 27) pandas/core/generic.py:4775— NDFrame._drop_axis has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_iLocIndexer._setitem_with_indexer_split_path (cognitive 27) pandas/core/indexing.py:2773— _iLocIndexer._setitem_with_indexer_split_path has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10, loops 2 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nanops._wrap_results (cognitive 27) pandas/core/nanops.py:363— nanops._wrap_results has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_AsOfMerge._validate_tolerance (cognitive 27) pandas/core/reshape/merge.py:2599— _AsOfMerge._validate_tolerance has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExcelFormatter.write (cognitive 27) pandas/io/formats/excel.py:960— ExcelFormatter.write has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
style_render._parse_latex_header_span (cognitive 27) REDACTED:2512— style_render._parse_latex_header_span has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 4 (16 pts), if/else 6 (11 pts) (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PythonParser._get_index_name (cognitive 27) pandas/io/parsers/python_parser.py:1135— PythonParser._get_index_name has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 1 (4 pts), error handling 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readers._read (cognitive 27) pandas/io/parsers/readers.py:362— readers._read has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mean_.sliding_mean (cognitive 26) pandas/core/_numba/kernels/mean_.py:68— mean_.sliding_mean has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 4 (10 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
var_.sliding_var (cognitive 26) pandas/core/_numba/kernels/var_.py:75— var_.sliding_var has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
astype.astype_is_view (cognitive 26) pandas/core/dtypes/astype.py:313— astype.astype_is_view has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (12 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
DataFrame.update (cognitive 26) pandas/core/frame.py:13464— DataFrame.update has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame._append_internal (cognitive 26) pandas/core/frame.py:15669— DataFrame._append_internal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), error handling 1 (3 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroupBy.shift (cognitive 26) pandas/core/groupby/groupby.py:5246— GroupBy.shift has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Grouping._codes_and_uniques (cognitive 26) pandas/core/groupby/grouper.py:636— Grouping._codes_and_uniques has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (26 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
grouper._factorize_monotonic (cognitive 26) pandas/core/groupby/grouper.py:966— grouper._factorize_monotonic has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_LocationIndexer._maybe_mask_setitem_value (cognitive 26) pandas/core/indexing.py:883— _LocationIndexer._maybe_mask_setitem_value has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (21 pts), boolean chains 5 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
nanops.nanmedian (cognitive 26) pandas/core/nanops.py:1065— nanops.nanmedian has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Styler.set_sticky (cognitive 26) REDACTED:2642— Styler.set_sticky has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 2 (6 pts), ternaries 3, boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
algorithms.value_counts_internal (cognitive 25) pandas/core/algorithms.py:1048— algorithms.value_counts_internal has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray.__getitem__ (cognitive 25) pandas/core/arrays/arrow/array.py:1126— ArrowExtensionArray.__getitem__ has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cast.infer_dtype_from_scalar (cognitive 25) pandas/core/dtypes/cast.py:701— cast.infer_dtype_from_scalar has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiIndex._verify_integrity (cognitive 25) pandas/core/indexes/multi.py:383— MultiIndex._verify_integrity has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Block.where (cognitive 25) pandas/core/internals/blocks.py:1323— Block.where has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, loops 1 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EABackedBlock.where (cognitive 25) pandas/core/internals/blocks.py:1867— EABackedBlock.where has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 1 (3 pts), error handling 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
missing._interpolate_1d (cognitive 25) pandas/core/missing.py:505— missing._interpolate_1d has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (19 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reshape.stack_reshape (cognitive 25) pandas/core/reshape/reshape.py:1089— reshape.stack_reshape has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CParserWrapper.__init__ (cognitive 25) pandas/io/parsers/c_parser_wrapper.py:76— CParserWrapper.__init__ has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 5, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HDFStore.copy (cognitive 25) pandas/io/pytables.py:2101— HDFStore.copy has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
pytables._maybe_convert_for_string_atom (cognitive 25) pandas/io/pytables.py:6344— pytables._maybe_convert_for_string_atom has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5, ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StataReader._read_old_header (cognitive 25) pandas/io/stata.py:1412— StataReader._read_old_header has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), loops 2 (4 pts), error handling 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._box_pa_scalar (cognitive 24) pandas/core/arrays/arrow/array.py:885— ArrowExtensionArray._box_pa_scalar has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 9 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray.__setitem__ (cognitive 24) pandas/core/arrays/arrow/array.py:3340— ArrowExtensionArray.__setitem__ has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
array._sparse_array_op (cognitive 24) pandas/core/arrays/sparse/array.py:241— array._sparse_array_op has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroupBy._insert_inaxis_grouper (cognitive 24) pandas/core/groupby/groupby.py:1026— GroupBy._insert_inaxis_grouper has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Grouper._set_grouper (cognitive 24) pandas/core/groupby/grouper.py:327— Grouper._set_grouper has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index._maybe_downcast_for_indexing (cognitive 24) pandas/core/indexes/base.py:6689— Index._maybe_downcast_for_indexing has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 9, error handling 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_LocationIndexer._getitem_lowerdim (cognitive 24) pandas/core/indexing.py:1282— _LocationIndexer._getitem_lowerdim has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 4, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_iLocIndexer._validate_key (cognitive 24) pandas/core/indexing.py:2345— _iLocIndexer._validate_key has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EABackedBlock.putmask (cognitive 24) pandas/core/internals/blocks.py:1943— EABackedBlock.putmask has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (3 pts), boolean chains 2, error handling 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockManager.as_array (cognitive 24) pandas/core/internals/managers.py:1863— BlockManager.as_array has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StringMethods.cat (cognitive 24) pandas/core/strings/accessor.py:494— StringMethods.cat has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 4, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
style._bar (cognitive 24) REDACTED:4442— style._bar has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 8 (10 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PythonParser._make_reader (cognitive 24) pandas/io/parsers/python_parser.py:207— PythonParser._make_reader has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
PythonParser._cast_types (cognitive 24) pandas/io/parsers/python_parser.py:484— PythonParser._cast_types has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, error handling 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HDFStore.append_to_multiple (cognitive 24) pandas/io/pytables.py:1734— HDFStore.append_to_multiple has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hist.hist_series (cognitive 24) pandas/plotting/_matplotlib/hist.py:489— hist.hist_series has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.dropna (cognitive 23) pandas/core/frame.py:8644— DataFrame.dropna has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.explode (cognitive 23) pandas/core/frame.py:14466— DataFrame.explode has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VariableOffsetWindowIndexer.get_window_bounds (cognitive 23) pandas/core/indexers/objects.py:297— VariableOffsetWindowIndexer.get_window_bounds has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 2 (3 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index._cmp_method (cognitive 23) pandas/core/indexes/base.py:7799— Index._cmp_method has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiIndex.get_loc (cognitive 23) pandas/core/indexes/multi.py:3660— MultiIndex.get_loc has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 3 (6 pts), loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
array_ops.logical_op (cognitive 23) pandas/core/ops/array_ops.py:459— array_ops.logical_op has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resample._adjust_dates_anchored (cognitive 23) pandas/core/resample.py:3135— resample._adjust_dates_anchored has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concat._sanitize_mixed_ndim (cognitive 23) pandas/core/reshape/concat.py:527— concat._sanitize_mixed_ndim has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
concat._get_result (cognitive 23) pandas/core/reshape/concat.py:577— concat._get_result has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concat._get_concat_axis_series (cognitive 23) pandas/core/reshape/concat.py:738— concat._get_concat_axis_series has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reshape.stack_v3 (cognitive 23) pandas/core/reshape/reshape.py:1002— reshape.stack_v3 has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
tile._nbins_to_bins (cognitive 23) pandas/core/reshape/tile.py:408— tile._nbins_to_bins has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ODSWriter._write_cells (cognitive 23) pandas/io/excel/_odswriter.py:93— ODSWriter._write_cells has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 8 (10 pts), boolean chains 1 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
ArrowParserWrapper.read (cognitive 23) pandas/io/parsers/arrow_parser_wrapper.py:611— ArrowParserWrapper.read has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 2, loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readers._iter_physical_lines (cognitive 23) pandas/io/parsers/readers.py:3691— readers._iter_physical_lines has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 3 (9 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
misc.scatter_matrix (cognitive 23) pandas/plotting/_matplotlib/misc.py:33— misc.scatter_matrix has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_testing.shares_memory (cognitive 22) pandas/_testing/__init__.py:523— _testing.shares_memory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
min_max_.grouped_min_max (cognitive 22) pandas/core/_numba/kernels/min_max_.py:133— min_max_.grouped_min_max has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 3, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FrameApply._agg_list_like_frame_reductions (cognitive 22) pandas/core/apply.py:1167— FrameApply._agg_list_like_frame_reductions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (4 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
datetimes._validate_tz_from_dtype (cognitive 22) pandas/core/arrays/datetimes.py:3036— datetimes._validate_tz_from_dtype has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, error handling 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeriodArray._from_sequence (cognitive 22) pandas/core/arrays/period.py:261— PeriodArray._from_sequence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowStringArray._from_sequence (cognitive 22) pandas/core/arrays/string_arrow.py:231— ArrowStringArray._from_sequence has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseExprVisitor.visit_Call (cognitive 22) pandas/core/computation/expr.py:693— BaseExprVisitor.visit_Call has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 2 (5 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeriesGroupBy.value_counts (cognitive 22) pandas/core/groupby/generic.py:1047— SeriesGroupBy.value_counts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
BaseGrouper.result_index_and_ids (cognitive 22) pandas/core/groupby/ops.py:881— BaseGrouper.result_index_and_ids has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiIndex.isin (cognitive 22) pandas/core/indexes/multi.py:4986— MultiIndex.isin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_AtIndexer._warn_if_expanding (cognitive 22) pandas/core/indexing.py:3521— _AtIndexer._warn_if_expanding has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Block._replace_coerce (cognitive 22) pandas/core/internals/blocks.py:957— Block._replace_coerce has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (5 pts), boolean chains 2 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
concat.concatenate_managers (cognitive 22) pandas/core/internals/concat.py:59— concat.concatenate_managers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nanops._maybe_null_out (cognitive 22) pandas/core/nanops.py:1993— nanops._maybe_null_out has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pivot._compute_grand_margin (cognitive 22) pandas/core/reshape/pivot.py:536— pivot._compute_grand_margin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 1 (3 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Series.__setitem__ (cognitive 22) pandas/core/series.py:1223— Series.__setitem__ has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 4 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseWindow._validate (cognitive 22) pandas/core/window/rolling.py:163— BaseWindow._validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StylerRenderer._generate_body_row (cognitive 22) REDACTED:819— StylerRenderer._generate_body_row has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StylerRenderer.relabel_index (cognitive 22) REDACTED:1489— StylerRenderer.relabel_index has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 2 (7 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
html._parse (cognitive 22) pandas/io/html.py:986— html._parse has cognitive complexity 22 (threshold 15). Drivers by points: if/else 3 (8 pts), error handling 3 (6 pts), boolean chains 3, ternaries 1 (3 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TextFileReader._get_options_with_defaults (cognitive 22) pandas/io/parsers/readers.py:2867— TextFileReader._get_options_with_defaults has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HDFStore.info (cognitive 22) pandas/io/pytables.py:2190— HDFStore.info has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (9 pts), error handling 2 (8 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pytables.read_hdf (cognitive 22) pandas/io/pytables.py:369— pytables.read_hdf has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), error handling 1 (2 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SQLTable.insert_data (cognitive 22) pandas/io/sql/base.py:357— SQLTable.insert_data has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StataWriter._check_column_names (cognitive 22) pandas/io/stata.py:2732— StataWriter._check_column_names has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LinePlot._make_plot (cognitive 22) pandas/plotting/_matplotlib/core.py:1639— LinePlot._make_plot has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_warnings.assert_produces_warning (cognitive 21) pandas/_testing/_warnings.py:29— _warnings.assert_produces_warning has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 2 (6 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Apply.wrap_results_dict_like (cognitive 21) pandas/core/apply.py:702— Apply.wrap_results_dict_like has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
take.take_2d_multi (cognitive 21) pandas/core/array_algos/take.py:183— take.take_2d_multi has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
expressions._can_use_numexpr (cognitive 21) pandas/core/computation/expressions.py:97— expressions._can_use_numexpr has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 1 (3 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cast.common_dtype_categorical_compat (cognitive 21) pandas/core/dtypes/cast.py:1246— cast.common_dtype_categorical_compat has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 1 (2 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
DataFrame.sort_values (cognitive 21) pandas/core/frame.py:9156— DataFrame.sort_values has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroupBy._concat_objects (cognitive 21) pandas/core/groupby/groupby.py:925— GroupBy._concat_objects has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
range._exact_int64_targets (cognitive 21) pandas/core/indexes/range.py:94— range._exact_int64_targets has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_LocationIndexer._maybe_restore_dropped_levels (cognitive 21) pandas/core/indexing.py:936— _LocationIndexer._maybe_restore_dropped_levels has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_iLocIndexer._decide_split_path (cognitive 21) pandas/core/indexing.py:2559— _iLocIndexer._decide_split_path has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_iLocIndexer._setitem_with_indexer_frame_value (cognitive 21) pandas/core/indexing.py:2896— _iLocIndexer._setitem_with_indexer_frame_value has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseBlockManager.apply (cognitive 21) pandas/core/internals/managers.py:413— BaseBlockManager.apply has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BlockManager.fast_xs (cognitive 21) pandas/core/internals/managers.py:1171— BlockManager.fast_xs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nanops.nansum (cognitive 21) pandas/core/nanops.py:787— nanops.nansum has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 1 (3 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_MergeOperation._get_join_info (cognitive 21) pandas/core/reshape/merge.py:1429— _MergeOperation._get_join_info has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
merge._convert_arrays_and_get_rizer_klass (cognitive 21) pandas/core/reshape/merge.py:3102— merge._convert_arrays_and_get_rizer_klass has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (21 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_Unstacker.get_new_values (cognitive 21) pandas/core/reshape/reshape.py:311— _Unstacker.get_new_values has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reshape._unstack_multiple (cognitive 21) pandas/core/reshape/reshape.py:489— reshape._unstack_multiple has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 1 (4 pts), loops 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExponentialMovingWindow.__init__ (cognitive 21) pandas/core/window/ewm.py:324— ExponentialMovingWindow.__init__ has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeriesFormatter._get_footer (cognitive 21) pandas/io/formats/format.py:207— SeriesFormatter._get_footer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_normalize.nested_to_record (cognitive 21) pandas/io/json/_normalize.py:71— _normalize.nested_to_record has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenericFixed.read_array (cognitive 21) pandas/io/pytables.py:3681— GenericFixed.read_array has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SAS7BDATReader._process_columntext_subheader (cognitive 21) pandas/io/sas/sas7bdat.py:744— SAS7BDATReader._process_columntext_subheader has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SAS7BDATReader._chunk_to_dataframe (cognitive 21) pandas/io/sas/sas7bdat.py:1183— SAS7BDATReader._chunk_to_dataframe has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MPLPlot._validate_color_args (cognitive 21) pandas/plotting/_matplotlib/core.py:470— MPLPlot._validate_color_args has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
take._take_preprocess_indexer_and_fill_value (cognitive 20) pandas/core/array_algos/take.py:576— take._take_preprocess_indexer_and_fill_value has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseMaskedArray._pad_or_backfill (cognitive 20) pandas/core/arrays/masked.py:289— BaseMaskedArray._pad_or_backfill has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SparseArray.__array_ufunc__ (cognitive 20) pandas/core/arrays/sparse/array.py:2837— SparseArray.__array_ufunc__ has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (19 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concat.concat_compat (cognitive 20) pandas/core/dtypes/concat.py:59— concat.concat_compat has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.to_records (cognitive 20) pandas/core/frame.py:2312— DataFrame.to_records has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame._getitem_multilevel (cognitive 20) pandas/core/frame.py:4408— DataFrame._getitem_multilevel has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Index.intersection (cognitive 20) pandas/core/indexes/base.py:3420— Index.intersection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DatetimeTimedeltaMixin._pin_freq (cognitive 20) pandas/core/indexes/datetimelike.py:827— DatetimeTimedeltaMixin._pin_freq has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 2 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MultiIndex.drop (cognitive 20) pandas/core/indexes/multi.py:2936— MultiIndex.drop has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 2 (4 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_iLocIndexer._setitem_new_column (cognitive 20) pandas/core/indexing.py:2620— _iLocIndexer._setitem_new_column has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
construction._extract_index (cognitive 20) pandas/core/internals/construction.py:635— construction._extract_index has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nanops._sum_timedelta_i8 (cognitive 20) pandas/core/nanops.py:869— nanops._sum_timedelta_i8 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Series.reset_index (cognitive 20) pandas/core/series.py:1456— Series.reset_index has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (20 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ObjectStringArrayMixin._str_split (cognitive 20) pandas/core/strings/object_array.py:345— ObjectStringArrayMixin._str_split has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_json._validate_pyarrow_engine_options (cognitive 20) pandas/io/json/_json.py:470— _json._validate_pyarrow_engine_options has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
HDFStore._identify_group (cognitive 20) pandas/io/pytables.py:2438— HDFStore._identify_group has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pytables._convert_index (cognitive 20) pandas/io/pytables.py:6173— pytables._convert_index has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
XportReader._read_header (cognitive 20) pandas/io/sas/sas_xport.py:293— XportReader._read_header has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
StataReader._read_new_value_labels (cognitive 20) pandas/io/stata.py:1528— StataReader._read_new_value_labels has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
boxplot.boxplot (cognitive 20) pandas/plotting/_matplotlib/boxplot.py:343— boxplot.boxplot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MPLPlot._make_legend (cognitive 20) pandas/plotting/_matplotlib/core.py:949— MPLPlot._make_legend has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
misc.parallel_coordinates (cognitive 20) pandas/plotting/_matplotlib/misc.py:344— misc.parallel_coordinates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Apply.compute_dict_like (cognitive 19) pandas/core/apply.py:602— Apply.compute_dict_like has cognitive complexity 19 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 4 (6 pts), boolean chains 2 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
masked_reductions._minmax (cognitive 19) pandas/core/array_algos/masked_reductions.py:136— masked_reductions._minmax has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray.__array_ufunc__ (cognitive 19) pandas/core/arrays/arrow/array.py:1252— ArrowExtensionArray.__array_ufunc__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
array._first_truncated_to_integer (cognitive 19) pandas/core/arrays/arrow/array.py:5129— array._first_truncated_to_integer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 2 (4 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
datetimes._sequence_to_dt64 (cognitive 19) pandas/core/arrays/datetimes.py:2658— datetimes._sequence_to_dt64 has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
missing.array_equivalent (cognitive 19) pandas/core/dtypes/missing.py:417— missing.array_equivalent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
DataFrame.corr (cognitive 19) pandas/core/frame.py:16573— DataFrame.corr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (5 pts), ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame._align_series (cognitive 19) pandas/core/generic.py:10348— NDFrame._align_series has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Grouping.__init__ (cognitive 19) pandas/core/groupby/grouper.py:456— Grouping.__init__ has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index.get_indexer (cognitive 19) pandas/core/indexes/base.py:3871— Index.get_indexer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
DatetimeTimedeltaMixin._get_delete_freq (cognitive 19) pandas/core/indexes/datetimelike.py:1562— DatetimeTimedeltaMixin._get_delete_freq has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 2 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
MultiIndex._format_multi (cognitive 19) pandas/core/indexes/multi.py:1690— MultiIndex._format_multi has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 1 (3 pts), loops 2, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RangeIndex.take (cognitive 19) pandas/core/indexes/range.py:1627— RangeIndex.take has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (19 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Block.fillna (cognitive 19) pandas/core/internals/blocks.py:1433— Block.fillna has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
ExtensionBlock._unwrap_setitem_indexer (cognitive 19) pandas/core/internals/blocks.py:2201— ExtensionBlock._unwrap_setitem_indexer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseBlockManager.reindex_indexer (cognitive 19) pandas/core/internals/managers.py:822— BaseBlockManager.reindex_indexer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), ternaries 1 (4 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
missing._index_to_interp_indices (cognitive 19) pandas/core/missing.py:465— missing._index_to_interp_indices has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sample.preprocess_weights (cognitive 19) pandas/core/sample.py:27— sample.preprocess_weights has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 1 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Series.combine (cognitive 19) pandas/core/series.py:3752— Series.combine has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
accessor.str_extractall (cognitive 19) pandas/core/strings/accessor.py:4875— accessor.str_extractall has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), ternaries 1 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
printing._pprint_seq (cognitive 19) pandas/io/formats/printing.py:116— printing._pprint_seq has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, ternaries 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
c_parser_wrapper._concatenate_chunks (cognitive 19) pandas/io/parsers/c_parser_wrapper.py:474— c_parser_wrapper._concatenate_chunks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppendableTable.delete (cognitive 19) pandas/io/pytables.py:5634— AppendableTable.delete has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MPLPlot._parse_errorbars (cognitive 19) pandas/plotting/_matplotlib/core.py:1188— MPLPlot._parse_errorbars has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_warnings._assert_caught_expected_warnings (cognitive 18) pandas/_testing/_warnings.py:174— _warnings._assert_caught_expected_warnings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_warnings._assert_caught_no_extra_warnings (cognitive 18) pandas/_testing/_warnings.py:215— _warnings._assert_caught_no_extra_warnings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray.factorize (cognitive 18) pandas/core/arrays/arrow/array.py:2280— ArrowExtensionArray.factorize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DatetimeArray._add_offset (cognitive 18) pandas/core/arrays/datetimes.py:802— DatetimeArray._add_offset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseMaskedArray.__iter__ (cognitive 18) pandas/core/arrays/masked.py:549— BaseMaskedArray.__iter__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (8 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NumpyExtensionArray.__array_ufunc__ (cognitive 18) pandas/core/arrays/numpy_.py:257— NumpyExtensionArray.__array_ufunc__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), error handling 1 (3 pts), ternaries 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IndexOpsMixin.to_numpy (cognitive 18) pandas/core/base.py:610— IndexOpsMixin.to_numpy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.select_dtypes (cognitive 18) pandas/core/frame.py:5498— DataFrame.select_dtypes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.combine (cognitive 18) pandas/core/frame.py:13203— DataFrame.combine has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.stack (cognitive 18) pandas/core/frame.py:14249— DataFrame.stack has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame._drop_labels_or_levels (cognitive 18) pandas/core/generic.py:1767— NDFrame._drop_labels_or_levels has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame.reindex (cognitive 18) pandas/core/generic.py:5320— NDFrame.reindex has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame._clip_with_one_bound (cognitive 18) pandas/core/generic.py:8961— NDFrame._clip_with_one_bound has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index.__repr__ (cognitive 18) pandas/core/indexes/base.py:1491— Index.__repr__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index._join_via_get_indexer (cognitive 18) pandas/core/indexes/base.py:4783— Index._join_via_get_indexer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (5 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
_iLocIndexer._setitem_with_indexer (cognitive 18) pandas/core/indexing.py:2699— _iLocIndexer._setitem_with_indexer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_iLocIndexer._setitem_with_indexer_2d_value (cognitive 18) pandas/core/indexing.py:2862— _iLocIndexer._setitem_with_indexer_2d_value has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Block.putmask (cognitive 18) pandas/core/internals/blocks.py:1256— Block.putmask has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concat._clean_keys_and_objs (cognitive 18) pandas/core/reshape/concat.py:817— concat._clean_keys_and_objs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
encoding.get_dummies (cognitive 18) pandas/core/reshape/encoding.py:44— encoding.get_dummies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
merge._fuse_key_view (cognitive 18) pandas/core/reshape/merge.py:3190— merge._fuse_key_view has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExcelFormatter._format_regular_rows (cognitive 18) pandas/io/formats/excel.py:773— ExcelFormatter._format_regular_rows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HTMLFormatter.__init__ (cognitive 18) pandas/io/formats/html.py:54— HTMLFormatter.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (7 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Styler._apply (cognitive 18) REDACTED:1984— Styler._apply has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
JsonReader.__init__ (cognitive 18) pandas/io/json/_json.py:1123— JsonReader.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_table_schema.build_table_schema (cognitive 18) pandas/io/json/_table_schema.py:252— _table_schema.build_table_schema has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
readers._refine_defaults_read (cognitive 18) pandas/io/parsers/readers.py:3440— readers._refine_defaults_read has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Table.validate (cognitive 18) pandas/io/pytables.py:4305— Table.validate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Table.validate_data_columns (cognitive 18) pandas/io/pytables.py:4765— Table.validate_data_columns has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Selection.__init__ (cognitive 18) pandas/io/pytables.py:6640— Selection.__init__ has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 1 (5 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
SAS7BDATReader._parse_metadata (cognitive 18) pandas/io/sas/sas7bdat.py:614— SAS7BDATReader._parse_metadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sas7bdat._utf8_translation_table (cognitive 18) pandas/io/sas/sas7bdat.py:79— sas7bdat._utf8_translation_table has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (6 pts), loops 4 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SQLTable._harmonize_columns (cognitive 18) pandas/io/sql/base.py:614— SQLTable._harmonize_columns has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 5, error handling 2 (5 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HistPlot._make_plot (cognitive 18) pandas/plotting/_matplotlib/hist.py:157— HistPlot._make_plot has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hist.hist_frame (cognitive 18) pandas/plotting/_matplotlib/hist.py:568— hist.hist_frame has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tools._get_layout (cognitive 18) pandas/plotting/_matplotlib/tools.py:91— tools._get_layout has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
var_.grouped_var (cognitive 17) pandas/core/_numba/kernels/var_.py:172— var_.grouped_var has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
take._take_2d_multi_object (cognitive 17) pandas/core/array_algos/take.py:547— take._take_2d_multi_object has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Categorical.map (cognitive 17) pandas/core/arrays/categorical.py:1699— Categorical.map has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 1 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
IntervalArray.astype (cognitive 17) pandas/core/arrays/interval.py:949— IntervalArray.astype has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), error handling 3 (6 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
period._get_ordinal_range (cognitive 17) pandas/core/arrays/period.py:1567— period._get_ordinal_range has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
SparseArray.__array__ (cognitive 17) pandas/core/arrays/sparse/array.py:933— SparseArray.__array__ has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (14 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SparseArray._arith_method (cognitive 17) pandas/core/arrays/sparse/array.py:2919— SparseArray._arith_method has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseStringArray._str_map_nan_semantics (cognitive 17) pandas/core/arrays/string_.py:559— BaseStringArray._str_map_nan_semantics has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
astype._astype_nansafe (cognitive 17) pandas/core/dtypes/astype.py:66— astype._astype_nansafe has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cast.maybe_cast_to_integer_array (cognitive 17) pandas/core/dtypes/cast.py:1544— cast.maybe_cast_to_integer_array has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 2, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NDFrame.sort_index (cognitive 17) pandas/core/generic.py:5264— NDFrame.sort_index has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NDFrame.interpolate (cognitive 17) pandas/core/generic.py:8241— NDFrame.interpolate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index._check_indexing_method (cognitive 17) pandas/core/indexes/base.py:4063— Index._check_indexing_method has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (17 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index.map (cognitive 17) pandas/core/indexes/base.py:6861— Index.map has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index.slice_locs (cognitive 17) pandas/core/indexes/base.py:7374— Index.slice_locs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Index.min (cognitive 17) pandas/core/indexes/base.py:8139— Index.min has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Index.max) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
Index.max (cognitive 17) pandas/core/indexes/base.py:8220— Index.max has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Index.min) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
base.maybe_sequence_to_range (cognitive 17) pandas/core/indexes/base.py:8332— base.maybe_sequence_to_range has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
TimedeltaIndex._get_arith_result_freq (cognitive 17) pandas/core/indexes/timedeltas.py:811— TimedeltaIndex._get_arith_result_freq has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timedeltas.timedelta_range (cognitive 17) pandas/core/indexes/timedeltas.py:937— timedeltas.timedelta_range has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
_MergeOperation._validate_validate_kwd (cognitive 17) pandas/core/reshape/merge.py:1973— _MergeOperation._validate_validate_kwd has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pivot._normalize (cognitive 17) pandas/core/reshape/pivot.py:1210— pivot._normalize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Series.case_when (cognitive 17) pandas/core/series.py:6781— Series.case_when has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (4 pts), error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sorting.get_group_index (cognitive 17) pandas/core/sorting.py:126— sorting.get_group_index has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 4 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
accessor._preprocess_regex_pattern (cognitive 17) pandas/core/strings/accessor.py:4913— accessor._preprocess_regex_pattern has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
datetimes.should_cache (cognitive 17) pandas/core/tools/datetimes.py:172— datetimes.should_cache has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Rolling._validate (cognitive 17) pandas/core/window/rolling.py:2008— Rolling._validate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), error handling 2 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ODFReader._get_cell_string_value (cognitive 17) pandas/io/excel/_odfreader.py:231— ODFReader._get_cell_string_value has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
_GenericArrayFormatter._format_strings (cognitive 17) pandas/io/formats/format.py:1252— _GenericArrayFormatter._format_strings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
StylerRenderer._render_typst (cognitive 17) REDACTED:255— StylerRenderer._render_typst has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ParserBase._clean_index_names (cognitive 17) pandas/io/parsers/base_parser.py:752— ParserBase._clean_index_names has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
readers._clean_na_values (cognitive 17) pandas/io/parsers/readers.py:3363— readers._clean_na_values has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AppendableTable.write_data (cognitive 17) pandas/io/pytables.py:5531— AppendableTable.write_data has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (6 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StataWriter._prepare_categoricals (cognitive 17) pandas/io/stata.py:2640— StataWriter._prepare_categoricals has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PiePlot._make_plot (cognitive 17) pandas/plotting/_matplotlib/core.py:2488— PiePlot._make_plot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (6 pts), ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
timeseries.maybe_resample (cognitive 17) pandas/plotting/_matplotlib/timeseries.py:123— timeseries.maybe_resample has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
asserters.assert_almost_equal (cognitive 16) pandas/_testing/asserters.py:81— asserters.assert_almost_equal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Apply.transform (cognitive 16) pandas/core/apply.py:371— Apply.transform has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
arraylike.dispatch_ufunc_with_out (cognitive 16) pandas/core/arraylike.py:473— arraylike.dispatch_ufunc_with_out has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ArrowExtensionArray._validate_setitem_value (cognitive 16) pandas/core/arrays/arrow/array.py:3672— ArrowExtensionArray._validate_setitem_value has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ExtensionArray._groupby_op (cognitive 16) pandas/core/arrays/base.py:3193— ExtensionArray._groupby_op has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseMaskedArray.__array_ufunc__ (cognitive 16) pandas/core/arrays/masked.py:887— BaseMaskedArray.__array_ufunc__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
BaseMaskedArray._reduce (cognitive 16) pandas/core/arrays/masked.py:1756— BaseMaskedArray._reduce has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PeriodArray.to_timestamp (cognitive 16) pandas/core/arrays/period.py:964— PeriodArray.to_timestamp has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SparseArray._cmp_or_logical_op (cognitive 16) pandas/core/arrays/sparse/array.py:2991— SparseArray._cmp_or_logical_op has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
common.is_bool_indexer (cognitive 16) pandas/core/common.py:113— common.is_bool_indexer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BaseExprVisitor.visit_Compare (cognitive 16) pandas/core/computation/expr.py:747— BaseExprVisitor.visit_Compare has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (8 pts), if/else 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
construction._try_cast (cognitive 16) pandas/core/construction.py:877— construction._try_cast has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concat.union_categoricals (cognitive 16) pandas/core/dtypes/concat.py:237— concat.union_categoricals has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrame.from_dict (cognitive 16) pandas/core/frame.py:1707— DataFrame.from_dict has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SeriesGroupBy.aggregate (cognitive 16) pandas/core/groupby/generic.py:346— SeriesGroupBy.aggregate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DataFrameGroupBy.aggregate (cognitive 16) pandas/core/groupby/generic.py:2118— DataFrameGroupBy.aggregate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GroupBy.size (cognitive 16) pandas/core/groupby/groupby.py:2719— GroupBy.size has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
utils.check_array_indexer (cognitive 16) pandas/core/indexers/utils.py:443— utils.check_array_indexer has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Index.take (cognitive 16) pandas/core/indexes/base.py:1243— Index.take has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Index.insert (cognitive 16) pandas/core/indexes/base.py:7552— Index.insert has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiIndex._union (cognitive 16) pandas/core/indexes/multi.py:4715— MultiIndex._union has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimedeltaIndex.__new__ (cognitive 16) pandas/core/indexes/timedeltas.py:708— TimedeltaIndex.__new__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Block._replace_regex (cognitive 16) pandas/core/internals/blocks.py:764— Block._replace_regex has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Block.setitem (cognitive 16) pandas/core/internals/blocks.py:1180— Block.setitem has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
managers._form_blocks (cognitive 16) pandas/core/internals/managers.py:2445— managers._form_blocks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), error handling 1 (2 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
missing.mask_missing (cognitive 16) pandas/core/missing.py:88— missing.mask_missing has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
missing._interpolate_scipy_wrapper (cognitive 16) pandas/core/missing.py:678— missing._interpolate_scipy_wrapper has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
nanops.nanvar (cognitive 16) pandas/core/nanops.py:1297— nanops.nanvar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
array_ops.comparison_op (cognitive 16) pandas/core/ops/array_ops.py:346— array_ops.comparison_op has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
resample._get_timestamp_range_edges (cognitive 16) pandas/core/resample.py:2972— resample._get_timestamp_range_edges has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
concat._get_sample_object (cognitive 16) pandas/core/reshape/concat.py:893— concat._get_sample_object has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
common.mangle_dupe_names (cognitive 16) REDACTED:1458— common.mangle_dupe_names has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CSSResolver.size_to_pt (cognitive 16) pandas/io/formats/css.py:379— CSSResolver.size_to_pt has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), error handling 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CSSToExcelConverter._border_style (cognitive 16) pandas/io/formats/excel.py:293— CSSToExcelConverter._border_style has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
StylerRenderer._translate (cognitive 16) REDACTED:329— StylerRenderer._translate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StylerRenderer._generate_col_header_row (cognitive 16) REDACTED:516— StylerRenderer._generate_col_header_row has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4 (5 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
style_render._parse_latex_css_conversion (cognitive 16) REDACTED:2577— style_render._parse_latex_css_conversion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
GenericFixed.read_index_node (cognitive 16) pandas/io/pytables.py:3839— GenericFixed.read_index_node has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
SQLTable._sqlalchemy_type (cognitive 16) pandas/io/sql/base.py:675— SQLTable._sqlalchemy_type has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
base._handle_date_column (cognitive 16) pandas/io/sql/base.py:117— base._handle_date_column has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StataReader._read_strls (cognitive 16) pandas/io/stata.py:1612— StataReader._read_strls has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DatetimeConverter._convert_1d (cognitive 16) pandas/plotting/_matplotlib/converter.py:395— DatetimeConverter._convert_1d has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TimeSeries_DateFormatter.__call__ (cognitive 16) pandas/plotting/_matplotlib/converter.py:1208— TimeSeries_DateFormatter.__call__ has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MPLPlot._get_errorbars (cognitive 16) pandas/plotting/_matplotlib/core.py:1283— MPLPlot._get_errorbars has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ScatterPlot._make_plot (cognitive 16) pandas/plotting/_matplotlib/core.py:1413— ScatterPlot._make_plot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D4 · Code Duplication· Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (8 members, 50+ identical tokens) pandas/core/frame.py:1100— pandas/core/frame.py:1100-1218 | pandas/core/frame.py:3248-3443 | pandas/core/frame.py:3509-3720 | pandas/core/generic.py:3899-4088 | pandas/io/excel/_base.py:203-563 | pandas/io/html.py:1085-1295 | pandas/io/json/_json.py:660-1020 | REDACTED:889-1230 — These 8 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 8 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 8 times.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) pandas/core/arrays/arrow/array.py:1253— pandas/core/arrays/arrow/array.py:1253-1312 | pandas/core/arrays/base.py:3118-3143 | pandas/core/arrays/categorical.py:1989-2014 | pandas/core/arrays/masked.py:893-968 | pandas/core/arrays/numpy_.py:264-323 | pandas/core/indexes/base.py:983-1024 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (5 members, 50+ identical tokens) pandas/core/groupby/generic.py:4129— pandas/core/groupby/generic.py:4129-4238 | pandas/io/excel/_base.py:766-841 | pandas/io/excel/_base.py:1759-1933 | pandas/plotting/_core.py:172-279 | pandas/plotting/_matplotlib/hist.py:586-654 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication· Edited copy of a member (62 corresponding lines) · ×1
Edited copy of a member (62 corresponding lines) pandas/core/arrays/datetimelike.py:1328— pandas/core/arrays/datetimelike.py:1328-1391 | pandas/core/arrays/datetimelike.py:1399-1460 — These two members are one piece of code written twice and then edited apart: 62 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 86+ corresponding lines) · ×1
Edited copies of one member (3 members, 86+ corresponding lines) pandas/core/_numba/kernels/mean_.py:75— pandas/core/_numba/kernels/mean_.py:75-162 | pandas/core/_numba/kernels/sum_.py:73-158 | pandas/core/_numba/kernels/var_.py:83-168 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 86 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (93 corresponding lines) · ×1
Edited copy of a member (93 corresponding lines) pandas/core/generic.py:11377— pandas/core/generic.py:11377-11469 | pandas/core/generic.py:11481-11682 — These two members are one piece of code written twice and then edited apart: 93 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (52 corresponding lines) · ×1
Edited copy of a member (52 corresponding lines) REDACTED:619— REDACTED:619-682 | REDACTED:766-817 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (121 corresponding lines) · ×1
Edited copy of a member (121 corresponding lines) REDACTED:1307— REDACTED:1307-1487 | REDACTED:1667-1787 — These two members are one piece of code written twice and then edited apart: 121 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (95 corresponding lines) · ×1
Edited copy of a member (95 corresponding lines) pandas/core/frame.py:19397— pandas/core/frame.py:19397-19491 | pandas/core/frame.py:19496-19590 — These two members are one piece of code written twice and then edited apart: 95 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 32+ corresponding lines) · ×1
Edited copies of one member (4 members, 32+ corresponding lines) pandas/core/window/ewm.py:826— pandas/core/window/ewm.py:826-913 | pandas/core/window/ewm.py:921-1012 | pandas/core/window/rolling.py:1921-1952 | pandas/core/window/rolling.py:1961-1992 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (82 corresponding lines) · ×1
Edited copy of a member (82 corresponding lines) pandas/core/window/ewm.py:542— pandas/core/window/ewm.py:542-623 | pandas/core/window/ewm.py:631-714 — These two members are one piece of code written twice and then edited apart: 82 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (66 corresponding lines) · ×1
Edited copy of a member (66 corresponding lines) pandas/core/groupby/groupby.py:3275— pandas/core/groupby/groupby.py:3275-3357 | pandas/core/groupby/groupby.py:3363-3428 — These two members are one piece of code written twice and then edited apart: 66 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (134 corresponding lines) · ×1
Edited copy of a member (134 corresponding lines) pandas/io/pytables.py:1362— pandas/io/pytables.py:1362-1495 | pandas/io/pytables.py:1594-1732 — These two members are one piece of code written twice and then edited apart: 134 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) pandas/core/arrays/sparse/array.py:2161— pandas/core/arrays/sparse/array.py:2161-2208 | pandas/core/arrays/sparse/array.py:2211-2256 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×1
Edited copy of a member (30 corresponding lines) pandas/core/arrays/categorical.py:2729— pandas/core/arrays/categorical.py:2729-2758 | pandas/core/arrays/categorical.py:2761-2790 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×1
Edited copies of one member (3 members, 17+ corresponding lines) pandas/io/clipboard/__init__.py:174— pandas/io/clipboard/__init__.py:174-201 | pandas/io/clipboard/__init__.py:205-228 | pandas/io/clipboard/__init__.py:514-530 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×1
Edited copy of a member (28 corresponding lines) pandas/io/sql/sqla.py:353— pandas/io/sql/sqla.py:353-425 | pandas/io/sql/sqlite.py:375-402 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) pandas/io/sql/sqla.py:439— pandas/io/sql/sqla.py:439-477 | pandas/io/sql/sqlite.py:424-494 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (43 corresponding lines) · ×1
Edited copy of a member (43 corresponding lines) pandas/core/series.py:3067— pandas/core/series.py:3067-3156 | pandas/core/series.py:3164-3206 — These two members are one piece of code written twice and then edited apart: 43 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×1
Edited copy of a member (19 corresponding lines) REDACTED:525— REDACTED:525-544 | REDACTED:637-655 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×1
Edited copy of a member (16 corresponding lines) pandas/io/formats/format.py:673— pandas/io/formats/format.py:673-696 | pandas/io/formats/format.py:699-714 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×1
Edited copy of a member (22 corresponding lines) pandas/core/apply.py:1925— pandas/core/apply.py:1925-1946 | pandas/core/apply.py:1951-1972 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (69 corresponding lines) · ×1
Edited copy of a member (69 corresponding lines) REDACTED:1364— REDACTED:1364-1437 | REDACTED:1654-1722 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (151 corresponding lines) · ×1
Edited copy of a member (151 corresponding lines) pandas/core/generic.py:2170— pandas/core/generic.py:2170-2320 | REDACTED:553-717 — These two members are one piece of code written twice and then edited apart: 151 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×1
Edited copy of a member (18 corresponding lines) pandas/core/nanops.py:2084— pandas/core/nanops.py:2084-2105 | pandas/core/nanops.py:2188-2205 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 111+ corresponding lines) · ×1
Edited copies of one member (3 members, 111+ corresponding lines) pandas/core/groupby/groupby.py:2822— pandas/core/groupby/groupby.py:2822-2932 | pandas/core/groupby/groupby.py:3032-3146 | pandas/core/groupby/groupby.py:3157-3269 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 111 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 97+ corresponding lines) · ×1
Edited copies of one member (3 members, 97+ corresponding lines) pandas/core/groupby/groupby.py:2050— pandas/core/groupby/groupby.py:2050-2146 | pandas/core/groupby/groupby.py:2256-2366 | pandas/core/groupby/groupby.py:2377-2479 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 97 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 15+ corresponding lines) · ×1
Edited copies of one member (4 members, 15+ corresponding lines) pandas/core/window/rolling.py:1657— pandas/core/window/rolling.py:1657-1671 | pandas/core/window/rolling.py:1679-1693 | pandas/core/window/rolling.py:1701-1715 | pandas/core/window/rolling.py:1723-1737 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (60 corresponding lines) · ×1
Edited copy of a member (60 corresponding lines) pandas/core/frame.py:10035— pandas/core/frame.py:10035-10122 | pandas/core/frame.py:10125-10184 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (47 corresponding lines) · ×1
Edited copy of a member (47 corresponding lines) pandas/core/nanops.py:679— pandas/core/nanops.py:679-725 | pandas/core/nanops.py:735-781 — These two members are one piece of code written twice and then edited apart: 47 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×1
Edited copy of a member (11 corresponding lines) pandas/io/pytables.py:2723— pandas/io/pytables.py:2723-2733 | pandas/io/pytables.py:3116-3128 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 5+ corresponding lines) · ×1
Edited copies of one member (3 members, 5+ corresponding lines) pandas/core/array_algos/masked_reductions.py:215— pandas/core/array_algos/masked_reductions.py:215-219 | pandas/core/array_algos/masked_reductions.py:230-237 | pandas/core/array_algos/masked_reductions.py:248-255 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×1
Edited copies of one member (3 members, 13+ corresponding lines) pandas/core/generic.py:11991— pandas/core/generic.py:11991-12003 | pandas/core/generic.py:12054-12068 | pandas/core/generic.py:12165-12185 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (71 corresponding lines) · ×1
Edited copy of a member (71 corresponding lines) pandas/core/base.py:809— pandas/core/base.py:809-879 | pandas/core/base.py:884-954 — These two members are one piece of code written twice and then edited apart: 71 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (224 corresponding lines) · ×1
Edited copy of a member (224 corresponding lines) pandas/core/frame.py:13646— pandas/core/frame.py:13646-13869 | pandas/core/series.py:2170-2397 — These two members are one piece of code written twice and then edited apart: 224 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (136 corresponding lines) · ×1
Edited copy of a member (136 corresponding lines) REDACTED:3164— REDACTED:3164-3308 | REDACTED:3321-3456 — These two members are one piece of code written twice and then edited apart: 136 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (5 corresponding lines) · ×1
Edited copy of a member (5 corresponding lines) pandas/core/arrays/timedeltas.py:410— pandas/core/arrays/timedeltas.py:410-418 | pandas/core/arrays/numpy_.py:576-580 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×1
Edited copy of a member (3 corresponding lines) pandas/core/arrays/_mixins.py:119— pandas/core/arrays/_mixins.py:119-121 | pandas/core/arrays/interval.py:699-701 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (4 corresponding lines) · ×1
Edited copy of a member (4 corresponding lines) pandas/core/arrays/_arrow_string_mixins.py:345— pandas/core/arrays/_arrow_string_mixins.py:345-348 | pandas/core/strings/object_array.py:46-49 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (232 corresponding lines) · ×1
Edited copy of a member (232 corresponding lines) pandas/core/frame.py:6582— pandas/core/frame.py:6582-6826 | pandas/core/series.py:5873-6104 — These two members are one piece of code written twice and then edited apart: 232 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (53 corresponding lines) · ×1
Edited copy of a member (53 corresponding lines) pandas/core/arrays/base.py:1697— pandas/core/arrays/base.py:1697-1749 | pandas/core/arrays/masked.py:1447-1499 — These two members are one piece of code written twice and then edited apart: 53 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (77 corresponding lines) · ×1
Edited copy of a member (77 corresponding lines) pandas/core/resample.py:348— pandas/core/resample.py:348-453 | pandas/core/window/rolling.py:1234-1310 — These two members are one piece of code written twice and then edited apart: 77 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (507–515 lines × 2) pandas/io/parsers/readers.py:1457— pandas/io/parsers/readers.py:1457-1971 | pandas/io/parsers/readers.py:2072-2578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/io/parsers/readers.py:1457` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (162–163 lines × 2) pandas/core/generic.py:10646— pandas/core/generic.py:10646-10808 | pandas/core/generic.py:10821-10982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (92–100 lines × 2) pandas/core/generic.py:7529— pandas/core/generic.py:7529-7620 | pandas/core/generic.py:7631-7730 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (79 lines × 2) pandas/core/frame.py:19397— pandas/core/frame.py:19397-19475 | pandas/core/frame.py:19496-19574 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/frame.py:19397` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (68–70 lines × 2) pandas/core/window/ewm.py:826— pandas/core/window/ewm.py:826-895 | pandas/core/window/ewm.py:921-988 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (35–59 lines × 2) pandas/core/arrays/_mixins.py:452— pandas/core/arrays/_mixins.py:452-486 | pandas/core/arrays/base.py:1456-1514 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (39 lines × 2) pandas/core/groupby/numba_.py:72— pandas/core/groupby/numba_.py:72-110 | pandas/core/groupby/numba_.py:129-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `func` to `Callable[..., Scalar]` in one and `Callable[..., np.ndarray]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (37 lines × 2) pandas/core/series.py:3067— pandas/core/series.py:3067-3142 | pandas/core/series.py:3164-3200 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (32 lines × 2) pandas/core/window/numba_.py:88— pandas/core/window/numba_.py:88-119 | pandas/core/window/numba_.py:270-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `pandas/core/window/numba_.py:120` calls `empty` and `pandas/core/window/numba_.py:302` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (25–29 lines × 2) pandas/io/stata.py:3066— pandas/io/stata.py:3066-3094 | pandas/io/stata.py:3613-3637 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/io/stata.py:3066` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (28 lines × 2) pandas/core/indexes/base.py:1303— pandas/core/indexes/base.py:1303-1330 | pandas/core/indexes/range.py:1635-1662 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19–26 lines × 2) pandas/core/arrays/arrow/array.py:1262— pandas/core/arrays/arrow/array.py:1262-1287 | pandas/core/arrays/base.py:3118-3136 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (23 lines × 2) pandas/core/window/rolling.py:1921— pandas/core/window/rolling.py:1921-1943 | pandas/core/window/rolling.py:1961-1983 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (14–20 lines × 2) pandas/core/arrays/datetimelike.py:1372— pandas/core/arrays/datetimelike.py:1372-1391 | pandas/core/arrays/datetimelike.py:1447-1460 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/arrays/datetimelike.py:1372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17–19 lines × 6) pandas/core/arrays/arrow/array.py:1276— pandas/core/arrays/arrow/array.py:1276-1292 | pandas/core/arrays/base.py:3125-3141 | pandas/core/arrays/categorical.py:1989-2007 | pandas/core/arrays/masked.py:902-919 | pandas/core/arrays/numpy_.py:268-286 | pandas/core/indexes/base.py:990-1007 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 6 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `method` to `str` in one and `str_t` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `pandas/core/arrays/masked.py:898` calls `isinstance` and `pandas/core/arrays/numpy_.py:266` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (19 lines × 2) pandas/core/reshape/merge.py:1772— pandas/core/reshape/merge.py:1772-1790 | pandas/core/reshape/merge.py:1794-1812 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16 lines × 5) pandas/core/groupby/generic.py:4222— pandas/core/groupby/generic.py:4222-4237 | pandas/io/excel/_base.py:818-833 | pandas/io/excel/_base.py:1918-1933 | pandas/plotting/_core.py:264-279 | pandas/plotting/_matplotlib/hist.py:596-611 — there are 5 copies across 4 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/groupby/generic.py:4222` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–16 lines × 2) pandas/io/excel/_openpyxl.py:537— pandas/io/excel/_openpyxl.py:537-551 | pandas/io/excel/_openpyxl.py:605-620 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/io/excel/_openpyxl.py:605` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 8) pandas/core/frame.py:1199— pandas/core/frame.py:1199-1213 | pandas/core/frame.py:3419-3433 | pandas/core/frame.py:3704-3718 | pandas/core/generic.py:4074-4088 | pandas/io/excel/_base.py:544-558 | pandas/io/html.py:1281-1295 | pandas/io/json/_json.py:1001-1015 | REDACTED:1216-1230 — there are 8 copies across 6 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/frame.py:1199` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 3) pandas/core/_numba/kernels/mean_.py:88— pandas/core/_numba/kernels/mean_.py:88-102 | pandas/core/_numba/kernels/sum_.py:92-106 | pandas/core/_numba/kernels/var_.py:97-111 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/_numba/kernels/mean_.py:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `sum_x` to `float` in one and `Any` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (13–15 lines × 2) REDACTED:379— REDACTED:379-393 | REDACTED:477-489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:379` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: `SubElement` names `lxml.etree` in one and `xml.etree.ElementTree` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (12–13 lines × 2) pandas/core/arrays/masked.py:1130— pandas/core/arrays/masked.py:1130-1141 | pandas/core/arrays/sparse/array.py:2948-2960 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: `ExtensionArray` names `pandas.core.arrays` in one and `pandas.core.arrays.base` in another — different types that share a simple name, which is why the text matched. A single extracted unit cannot be given a parameter type that fits both, so unifying those types (or introducing a shared abstraction over them) is the step that has to come BEFORE the extraction above; if they are deliberately separate, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (11–13 lines × 2) REDACTED:4403— REDACTED:4403-4415 | REDACTED:4416-4426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:4403` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11–12 lines × 3) pandas/core/internals/blocks.py:1372— pandas/core/internals/blocks.py:1372-1382 | pandas/core/internals/blocks.py:1923-1934 | pandas/core/internals/blocks.py:2001-2012 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/internals/blocks.py:1372` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9–12 lines × 2) pandas/core/indexes/datetimes.py:102— pandas/core/indexes/datetimes.py:102-113 | pandas/core/indexes/timedeltas.py:83-91 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (10–12 lines × 2) pandas/core/reshape/concat.py:752— pandas/core/reshape/concat.py:752-761 | pandas/core/reshape/concat.py:803-814 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (17–18 lines × 2) pandas/core/_numba/kernels/sum_.py:171— pandas/core/_numba/kernels/sum_.py:171-187 | pandas/core/_numba/kernels/var_.py:181-198 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10–11 lines × 2) pandas/core/arrays/base.py:1650— pandas/core/arrays/base.py:1650-1659 | pandas/core/arrays/sparse/array.py:1322-1332 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (8–10 lines × 2) pandas/plotting/_matplotlib/converter.py:923— pandas/plotting/_matplotlib/converter.py:923-932 | pandas/plotting/_matplotlib/converter.py:997-1004 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pandas/core/array_algos/take.py:282— pandas/core/array_algos/take.py:282-290 | pandas/core/array_algos/take.py:296-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8–9 lines × 2) pandas/tseries/frequencies.py:570— pandas/tseries/frequencies.py:570-578 | pandas/tseries/frequencies.py:633-640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/tseries/frequencies.py:570` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6–8 lines × 2) pandas/core/reshape/merge.py:1753— pandas/core/reshape/merge.py:1753-1760 | pandas/core/reshape/merge.py:1762-1767 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pandas/core/reshape/merge.py:1753` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7–8 lines × 2) pandas/core/window/numba_.py:310— pandas/core/window/numba_.py:310-316 | pandas/core/window/online.py:62-69 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 4) pandas/core/strings/accessor.py:941— pandas/core/strings/accessor.py:941-947 | pandas/core/strings/accessor.py:1078-1084 | pandas/core/strings/accessor.py:1170-1176 | pandas/core/strings/accessor.py:1262-1268 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 3) pandas/io/stata.py:224— pandas/io/stata.py:224-230 | pandas/io/stata.py:232-236 | pandas/io/stata.py:237-242 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) pandas/core/arrays/base.py:629— pandas/core/arrays/base.py:629-634 | pandas/core/dtypes/base.py:179-184 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (107 lines × 2) pandas/core/frame.py:9502— pandas/core/frame.py:9502-9608 | pandas/core/series.py:4368-4508 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (40 lines × 2) pandas/core/indexes/datetimes.py:976— pandas/core/indexes/datetimes.py:976-1019 | pandas/core/indexes/timedeltas.py:623-662 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (33 lines × 2) pandas/core/indexes/datetimes.py:1025— pandas/core/indexes/datetimes.py:1025-1068 | pandas/core/indexes/period.py:281-313 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (74 lines × 2) pandas/core/window/expanding.py:263— pandas/core/window/expanding.py:263-336 | pandas/core/window/rolling.py:2216-2321 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
Third-party script without Subresource Integrity REDACTED:4— `https://views.scientific-python.org/js/script.js` is executed by this page with no Subresource Integrity. Whoever can answer that request — the CDN, anyone who compromises it, anyone on the network path — runs arbitrary script in this page's origin, with its session. The URL also names no version, so it resolves to whatever that origin serves at fetch time — the executed bytes can change with nobody touching this repository.
Duplicated predicate pandas/io/excel/_odswriter.py:186— `cell.mergestart is not None and cell.mergeend is not None` appears character-identically in 3 files — pandas/io/excel/_odswriter.py, pandas/io/excel/_openpyxl.py, pandas/io/excel/_xlsxwriter.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/io/excel/_openpyxl.py:749— `converted_row and converted_row[-1] == ""` appears character-identically in 2 files — pandas/io/excel/_openpyxl.py, pandas/io/excel/_pyxlsb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/indexes/base.py:5606— `dtype is None or astype_is_view(data.dtype, pandas_dtype(dtype))` appears character-identically in 2 files — pandas/core/indexes/base.py, pandas/core/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/generic.py:532— `dtype.kind == "V" and not isinstance(dtype, ExtensionDtype)` appears character-identically in 2 files — pandas/core/generic.py, pandas/core/indexes/base.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/io/excel/_openpyxl.py:755— `file_rows_needed is not None and len(data) >= file_rows_needed` appears character-identically in 2 files — pandas/io/excel/_openpyxl.py, pandas/io/excel/_pyxlsb.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/indexes/datetimes.py:2748— `freq is None and com.any_none(periods, start, end)` appears character-identically in 3 files — pandas/core/indexes/datetimes.py, pandas/core/indexes/interval.py, pandas/core/indexes/timedeltas.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/frame.py:7632— `freq is not None and fill_value is not lib.no_default` appears character-identically in 2 files — pandas/core/frame.py, pandas/core/generic.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/frame.py:1689— `hasattr(data, "__arrow_c_array__") or hasattr(data, "__arrow_c_stream__")` appears character-identically in 2 files — pandas/core/frame.py, pandas/core/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/_numba/kernels/mean_.py:91— `i == 0 or not is_monotonic_increasing_bounds` appears character-identically in 3 files — pandas/core/_numba/kernels/mean_.py, pandas/core/_numba/kernels/sum_.py, pandas/core/_numba/kernels/var_.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/indexes/base.py:1342— `indices.ndim == 1 and lib.is_range_indexer(indices, len(self))` appears character-identically in 2 files — pandas/core/indexes/base.py, pandas/core/indexes/multi.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/frame.py:14941— `is_float(periods) and periods.is_integer()` appears character-identically in 2 files — pandas/core/frame.py, pandas/core/series.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/arrays/masked.py:1005— `is_list_like(other) and not isinstance(other, (list, np.ndarray, ExtensionArray)) and not ops.has_castable_attr(other)` appears character-identically in 2 files — pandas/core/arrays/masked.py, pandas/core/arrays/sparse/array.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/_numba/kernels/mean_.py:82— `is_monotonic_increasing( start ) and is_monotonic_increasing(end)` appears character-identically in 3 files — pandas/core/_numba/kernels/mean_.py, pandas/core/_numba/kernels/sum_.py, pandas/core/_numba/kernels/var_.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/io/parsers/base_parser.py:371— `isinstance(col, int) and col not in self.orig_names` appears character-identically in 2 files — pandas/io/parsers/base_parser.py, pandas/io/parsers/python_parser.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/construction.py:369— `isinstance(data, np.ndarray) and data.dtype.names is not None` appears character-identically in 2 files — pandas/core/construction.py, pandas/core/internals/construction.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/arrays/categorical.py:836— `isinstance(dtype, CategoricalDtype) and dtype.categories is not None` appears character-identically in 2 files — pandas/core/arrays/categorical.py, pandas/core/ops/invalid.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/arrays/string_.py:765— `isinstance(dtype, str) and dtype == "string"` appears character-identically in 2 files — pandas/core/arrays/string_.py, pandas/core/arrays/string_arrow.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/arrays/arrow/array.py:3365— `isinstance(key, tuple) and len(key) == 1` appears character-identically in 2 files — pandas/core/arrays/arrow/array.py, pandas/core/indexing.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/groupby/groupby.py:758— `isinstance(keys, list) and len(keys) == 1` appears character-identically in 2 files — pandas/core/groupby/groupby.py, pandas/plotting/_matplotlib/misc.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/_testing/__init__.py:527— `isinstance(left, np.ndarray) and isinstance(right, np.ndarray)` appears character-identically in 2 files — pandas/_testing/__init__.py, pandas/_testing/asserters.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/_testing/asserters.py:337— `isinstance(left.dtype, CategoricalDtype) and isinstance( right.dtype, CategoricalDtype )` appears character-identically in 2 files — pandas/_testing/asserters.py, pandas/core/reshape/merge.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/arrays/boolean.py:258— `isinstance(mask, np.ndarray) and mask.dtype == np.bool_` appears character-identically in 2 files — pandas/core/arrays/boolean.py, pandas/core/arrays/masked.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/arrays/_arrow_string_mixins.py:377— `isinstance(repl, str) and r"\g<" in repl` appears character-identically in 3 files — pandas/core/arrays/_arrow_string_mixins.py, pandas/core/arrays/arrow/array.py, pandas/core/arrays/string_arrow.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/arrays/base.py:630— `isinstance(state, dict) and "_cache" in state` appears character-identically in 2 files — pandas/core/arrays/base.py, pandas/core/dtypes/base.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate pandas/core/computation/expr.py:687— `isinstance(value, ast.Name) and value.id == attr` appears character-identically in 2 files — pandas/core/computation/expr.py, pandas/core/computation/pytables.py. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Orphaned file pandas/core/_numba/extensions.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/core/interchange/dataframe_protocol.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file asv_bench/benchmarks/strings.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file asv_bench/benchmarks/sparse.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/core/arrays/sparse/scipy_sparse.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/core/ops/mask_ops.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file scripts/check_test_naming.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file asv_bench/benchmarks/plotting.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/plotting/_matplotlib/groupby.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file scripts/check_for_inconsistent_pandas_namespace.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file asv_bench/benchmarks/array.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/core/interchange/dataframe.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file scripts/validate_exception_location.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/core/interchange/buffer.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file asv_bench/benchmarks/io/style.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/core/array_algos/masked_accumulations.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file pandas/api/typing/aliases.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file asv_bench/benchmarks/io/excel.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file scripts/sort_whatsnew_note.py:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 18 significant file(s) lose their only recent owner: pandas/io/clipboard/__init__.py, pandas/core/array_algos/take.py, pandas/plotting/_matplotlib/hist.py, asv_bench/benchmarks/rolling.py, pandas/io/sas/sas_constants.py, asv_bench/benchmarks/algos/isin.py, pandas/core/computation/scope.py, asv_bench/benchmarks/inference.py (+10 more). Pair on, review, or document these before any departure.
Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 4 significant file(s) lose their only recent owner: scripts/issue_assignment/client.py, scripts/issue_assignment/core.py, scripts/issue_assignment/messages.py, scripts/issue_assignment/label_awaiting_review.py. Pair on, review, or document these before any departure.
Silent fallback default on parse failure pandas/core/dtypes/common.py:707— `condition` (in `is_string_dtype`) returns `False` when `TypeError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default on parse failure scripts/validate_unwanted_patterns.py:83— `_get_literal_string_prefix_len` returns `0` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 4 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (26 single-owned of 286 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 286 of the 386 production source files in this repository met that bar). They are anonymized user #3 (1 file(s)), anonymized user #4 (1 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: asv_bench/benchmarks/reshape.py, asv_bench/benchmarks/index_object.py, asv_bench/benchmarks/stat_ops.py, pandas/core/arrays/arrow/extension_types.py.
D21 · Naming Consistency· `ReadCsvBuffer` spells `Csv` where 27 names in the project spell it `CSV` · ×1
`ReadCsvBuffer` spells `Csv` where 27 names in the project spell it `CSV` pandas/_typing.py:315— 27 of 28 names in project pandas spell the token `CSV` (27 of 28; unit: names in project pandas containing `CSV`). Peers: asv_bench.benchmarks.gil.ParallelReadCSV (asv_bench/benchmarks/gil.py:264); asv_bench.benchmarks.io.csv.ToCSV (asv_bench/benchmarks/io/csv.py:24); asv_bench.benchmarks.io.csv.ToCSVFloatFormatVariants (asv_bench/benchmarks/io/csv.py:56); asv_bench.benchmarks.io.csv.ToCSVMultiIndexUnusedLevels (asv_bench/benchmarks/io/csv.py:75); asv_bench.benchmarks.io.csv.ToCSVDatetime (asv_bench/benchmarks/io/csv.py:94). Rename to `ReadCSVBuffer`. [rule N6]
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 19 of 286 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 286 of the 386 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: pandas/core/_numba/extensions.py, pandas/core/interchange/dataframe_protocol.py, asv_bench/benchmarks/strings.py, asv_bench/benchmarks/sparse.py, pandas/core/arrays/sparse/scipy_sparse.py, pandas/core/ops/mask_ops.py, scripts/check_test_naming.py, asv_bench/benchmarks/plotting.py (and 11 more). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No src/ separation — Most of the production code is in directories of its own, but 2 application file(s) sit at the repository root beside the build and tooling files (`generate_pxi.py`, `generate_version.py`).
P3 · Security & performance tooling· Dependabot does not watch pip · ×1
Dependabot does not watch pip .github/dependabot.yml:2— `.github/dependabot.yml` schedules updates, but no `package-ecosystem` entry covers `pip`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
Silent fallback default in catch pandas/plotting/_matplotlib/core.py:1864— `get_label` (in `_post_plot_logic`) swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency — This repository's Python dependencies were read: 3 shipped distribution(s) across 2 manifest(s) (84 development or optional declaration(s) excluded, because a consumer does not install them). Whether any of them is behind its current release is the dependency-CURRENCY question, and no declaration here carries an EXACT pin to ask it about — every one is a floor or a range, which installs the newest release it admits and therefore cannot be behind one. That is a healthy declaration style, NOT a defect and NOT a gap in this analyzer; there is simply no currency question to answer. This is NOT a finding that these dependencies are current or healthy. Lockfiles are deliberately not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock): the four disagree about dev/optional membership, and misreading one would charge a test-only package a consumer never receives. Known CVEs in the same dependency graph are a separate question, reported under D30.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1db4f-97f4-7736-a748-c92b7c6c04cc · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 23 · Warnings: 1887 · Recommendations: 75 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 14-11-2026 @ 18:26 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.