Notebook Cleanup and Structure Review
Turn an exploratory notebook into a readable one.
The Open buttons send the prompt text as currently shown below to that site only when you click. Fill in the placeholders first.
Review my notebook structure. Notebook description or outline of cells: [NOTEBOOK_OUTLINE]. Who will read it and how it will be used: [AUDIENCE_AND_USE]. Current problems: [PROBLEMS]. Produce: 1. A diagnosis table: Problem (out-of-order execution, hidden state, hard-coded paths, giant cells, no explanation, unused cells, secrets in code) | Where it appears | Risk | Fix. 2. A target structure with section headings: purpose and question; setup and imports; data loading with paths from one config cell; cleaning; analysis; results and figures; conclusions and limitations; how to rerun. 3. A rewritten outline of my notebook in that structure with a markdown sentence for each section that explains why, not just what. 4. Refactoring rules: move reusable code into functions in a module, keep cells under about 20 lines, set random seeds in one place. 5. A restart-and-run-all test: what to check and the result to expect. 6. A checklist for removing sensitive data and outputs before sharing. Do not change the analysis results; note anything that looks wrong for me to check.
Fill in before use
Optional: type your details and the prompt above updates. Nothing is saved or sent.
Replace each bracketed placeholder with your own details, then paste into Any AI or another assistant.
See an example result (fictional data)
Findings - Cell order: cell 14 uses df_clean defined in cell 22 (hidden state). - Imports scattered in 6 cells. - Magic numbers: 0.2, 42 without names. - Outputs of 300 rows printed. Proposed structure: 1 Title and purpose; 2 Setup (imports, constants); 3 Load data; 4 Clean; 5 Analyse; 6 Results; 7 Next steps. Actions: restart and run all; move imports to the top; name constants TEST_SIZE, SEED; limit outputs with head(). Result: notebook runs top to bottom in 4 minutes. Move reusable functions to a module.
Illustrative only, made-up data. Your results will differ and must be reviewed.