pandas-scikit-learn-guide-cursorrules-prompt-file — правило для Cursor
Настраивает Cursor для анализа данных на Python. Требует векторизацию в pandas, проверку пропусков, оформление графиков и соблюдение структуры блокнотов.
.cursor/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdcЧто делает pandas-scikit-learn-guide-cursorrules-prompt-file
Правило задаёт стандарты работы с библиотеками pandas, numpy, matplotlib и seaborn. Ассистент генерирует код в функциональном стиле без лишних классов. Для выборки значений используются loc и iloc, а преобразования собираются через метод-чейнинг. Никаких медленных явных циклов: предпочтение всегда отдаётся векторизованным операциям.
Визуализация строится на двух уровнях. seaborn отвечает за статистические графики, а matplotlib используется для ручной настройки осей и заголовков. В блокнотах Jupyter ячейки структурируются через markdown с фиксацией порядка выполнения. Для работы с большими объёмами данных, не помещающимися в RAM, инструкция предлагает задействовать dask.
В правиле прямо прописано требование проверять цветовую палитру графиков на читаемость для людей с дальтонизмом.
Какие задачи решает
- избавиться от явных циклов при обработке датафреймов
- настроить воспроизводимую структуру ячеек в Jupyter Notebook
- валидировать типы данных и обрабатывать пропуски перед расчётами
- строить статистические графики с палитрами для дальтоников
Примеры запросов агенту
- Сгруппируй продажи по регионам через метод-чейнинг и рассчитай средний чек
- Проверь датасет на пропущенные значения и подготовь отчёт по типам данных
- Построй распределение признаков через seaborn с палитрой для людей с дальтонизмом
Как установить pandas-scikit-learn-guide-cursorrules-prompt-file
Вручную: положить файлы
.cursor/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/pandas-scikit-learn-guide-cursorrules-prompt-file.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdВручную: положить файлы
.clinerules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о pandas-scikit-learn-guide-cursorrules-prompt-file
Как установить pandas-scikit-learn-guide-cursorrules-prompt-file в Cursor?
Добавьте файл правила по пути .cursor/rules/pandas-scikit-learn-guide-cursorrules-prompt-file.mdc в корневом каталоге проекта.
Что делает pandas-scikit-learn-guide-cursorrules-prompt-file?
Инструкция обязывает ИИ писать быстрый векторизованный код на pandas и numpy, избегать избыточных классов и структурировать блокноты Jupyter.
Какие библиотеки упоминаются в требованиях правила?
Правило рассчитано на работу с pandas, numpy, matplotlib, seaborn, jupyter и scikit-learn. Для массивов данных больше оперативной памяти упоминается dask.
Исходный текст
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