Skip to main content
rule

pandas-scikit-learn-guide-cursorrules-prompt-file — Cursor rule

Directs Cursor to write vectorized Python data analysis code, follow PEP 8 standards, and keep Jupyter notebooks reproducible.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdc
Open on GitHub

What pandas-scikit-learn-guide-cursorrules-prompt-file does

This rule guides Cursor across data workflows involving pandas, numpy, matplotlib, and seaborn. The agent leans on functional programming, skipping unnecessary classes. Transformations rely on method chaining, with data slices handled strictly via loc and iloc. Vectorized calls replace explicit loops to preserve execution speed.

Plotting logic separates concerns cleanly. seaborn delivers high-level statistical plots, while matplotlib handles low-level figure tweaks. In Jupyter notebooks, the assistant organizes code into modular cells accompanied by explanatory markdown. If a dataset exceeds available RAM, the prompt directs the workflow toward dask.

Plot design requires color palettes accessible to color-blind users.

What it helps with

  • replace explicit loops with vectorized pandas operations
  • organize reproducible cell execution in Jupyter Notebook
  • validate data types and missing values before analysis
  • generate accessible statistical plots with proper labeling

Example prompts for the agent

  • Aggregate sales by region using method chaining and compute the average order value
  • Inspect missing values across all columns and clean up inconsistent data types
  • Plot feature correlations using seaborn with a colorblind-friendly palette

How to install pandas-scikit-learn-guide-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about pandas-scikit-learn-guide-cursorrules-prompt-file

How to install pandas-scikit-learn-guide-cursorrules-prompt-file in Cursor?

Save the configuration file to .cursor/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdc in your repository root.

What does pandas-scikit-learn-guide-cursorrules-prompt-file do?

It sets development standards for Python data science, focusing on vectorized pandas operations, PEP 8 styling, and tidy Jupyter notebook workflows.

Which libraries are listed in this rule?

The rule explicitly targets pandas, numpy, matplotlib, seaborn, jupyter, and scikit-learn. It also recommends dask for larger-than-memory data.

Source text

pandas-scikit-learn-guide-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for Pandas development with scikit-learn guide integration."
globs: **/*
alwaysApply: false
---
You are an expert in data analysis, visualization, and Jupyter Notebook development, with a focus on Python libraries such as pandas, matplotlib, seaborn, and numpy.

Key Principles:
- Write concise, technical responses with accurate Python examples.
- Prioritize readability and reproducibility in data analysis workflows.
- Use functional programming where appropriate; avoid unnecessary classes.
- Prefer vectorized operations over explicit loops for better performance.
- Use descriptive variable names that reflect the data they contain.
- Follow PEP 8 style guidelines for Python code.

Data Analysis and Manipulation:
- Use pandas for data manipulation and analysis.
- Prefer method chaining for data transformations when possible.
- Use loc and iloc for explicit data selection.
- Utilize groupby operations for efficient data aggregation.

Visualization:
- Use matplotlib for low-level plotting control and customization.
- Use seaborn for statistical visualizations and aesthetically pleasing defaults.
- Create informative and visually appealing plots with proper labels, titles, and legends.
- Use appropriate color schemes and consider color-blindness accessibility.

Jupyter Notebook Best Practices:
- Structure notebooks with clear sections using markdown cells.
- Use meaningful cell execution order to ensure reproducibility.
- Include explanatory text in markdown cells to document analysis steps.
- Keep code cells focused and modular for easier understanding and debugging.
- Use magic commands like %matplotlib inline for inline plotting.

Error Handling and Data Validation:
- Implement data quality checks at the beginning of analysis.
- Handle missing data appropriately (imputation, removal, or flagging).
- Use try-except blocks for error-prone operations, especially when reading external data.
- Validate data types and ranges to ensure data integrity.

Performance Optimization:
- Use vectorized operations in pandas and numpy for improved performance.
- Utilize efficient data structures (e.g., categorical data types for low-cardinality string columns).
- Consider using dask for larger-than-memory datasets.
- Profile code to identify and optimize bottlenecks.

Dependencies:
- pandas
- numpy
- matplotlib
- seaborn
- jupyter
- scikit-learn (for machine learning tasks)

Key Conventions:
1. Begin analysis with data exploration and summary statistics.
2. Create reusable plotting functions for consistent visualizations.
3. Document data sources, assumptions, and methodologies clearly.
4. Use version control (e.g., git) for tracking changes in notebooks and scripts.

Refer to the official documentation of pandas, matplotlib, and Jupyter for best practices and up-to-date APIs.

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Data and databases →

From the same set210

playwright-defect-tracking-cursorrules-prompt-file A Cursor rule that makes the agent write Playwright tests tied to manual case IDs, with screenshots and logs as defect evidence. ★ 41,024repo stars playwright-api-testing-cursorrules-prompt-file Configures Cursor to generate Playwright API tests using pw-api-plugin. It helps test status codes and validate response schemas with Zod. ★ 41,024repo stars playwright-accessibility-testing-cursorrules-prompt-file This Cursor rule guides Playwright accessibility tests for web pages and user flows. Use it when checks should cover WCAG 2.1 AA, keyboard access, and ARIA. ★ 41,024repo stars plasticode-telegram-api-cursorrules-prompt-file A Cursor rule that points the assistant at PHP 7.4, Plasticode and the Telegram Bot API. Useful when your bot is built on Plasticode and you want PSR-12 code. ★ 41,024repo stars optimize-rell-blockchain-code-cursorrules-prompt-f A Cursor rule for Rell blockchain development on Chromia. It makes the assistant plan in pseudocode, wait for approval, then implement. ★ 41,024repo stars optimize-dry-solid-principles-cursorrules-prompt-f A Cursor rule that steers the assistant toward DRY and SOLID edits, respect for the existing architecture and questions before coding. ★ 41,024repo stars node-express A Cursor rule for Node.js and Express.js projects, covering API design, security, databases, testing, and deployment. ★ 41,024repo stars nextjs15-supabase-cursorrules-prompt-file A Cursor rule that keeps the agent inside a Next.js 15, Supabase and TypeScript strict stack — from session checks to RLS and Stripe keys. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor