From Ridge and Lasso Regression: A Complete Guide with Python Scikit-Learn by Saptashwa

…latively poor than the training score then it’s the problem of over-generalization or over-fitting. **Ridge and Lasso regression are some of the simple techniques to reduce model complexity and prevent over-fitting which may result from simple linear regression**.

From A Beginner’s Guide to Optimizing Pandas Code for Speed by Sofia Heisler

This brings us to a few basic conclusions on optimizing Pandas code:

1. Avoid loops; they’re slow and, in most common use cases, unnecessary.

2. If you must loop, use `apply()`

, not iteration functions.

3. Vectorization is usually better than scalar operations. Most common operations in Pandas can be vectorized.

4. Vector operations on NumPy arrays are more efficient than on native Pandas series.