Replace pandas with polars for better efficiency in core data processing modules #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR migrates pyprophet's core data processing functionality from pandas to polars, delivering significant performance improvements for large-scale proteomics data analysis.
Performance Benefits
Polars provides several key advantages over pandas:
Modules Converted
Core Foundation (5 modules, 39 pandas usages)
io/_base.py(21 usages) - Abstract base classes for data readers/writersscoring/data_handling.py(8 usages) - Core ML data processing and Experiment classreport.py(5 usages) - Analysis reporting and visualizationstats.py(4 usages) - Statistical calculations and metricssplit.py(1 usage) - File processing operationsKey Changes
DataFrame Operations
Data Access
Backward Compatibility
A new compatibility layer (
pyprophet/util/compat.py) ensures smooth transitions:External libraries requiring pandas (e.g., scikit-learn) use conversion bridges:
Testing and Documentation
test_polars_compat.pyvalidates conversion utilitiesPOLARS_MIGRATION.mddocuments all changes and benefitsImpact
This migration affects the most performance-critical data processing operations in pyprophet while maintaining full backward compatibility. Users will see immediate performance improvements for large datasets without any code changes required.
The remaining modules (export, glyco, IPF) can be migrated incrementally in future updates as this establishes the foundation and patterns for the full transition.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.