ENH: Make performance warnings opt-in and more noisy · Issue #55385 · pandas-dev/pandas (original) (raw)
At times, I think our performance warnings can be too noisy. For example, if I'm doing an ad hoc analysis on a small data set, I don't care about performance. Other times, I purposefully have a MultiIndex with a particular order because it's important to the analysis I'm doing, and working with the data produces lexsort warnings.
One idea is to make performance warnings opt-in (via an option) and more noisy. The idea here would be that a user has written a piece of code they're happy with, and then they can enable performance warnings to see if pandas thinks they're being ill-performant. Doing this, we can start emitting more warnings to try to nudge users to more performant options.
Some cases where we could warn:
- Using agg / apply / transform with a Python callable (a UDF)
- Using merge on columns rather than indices if the index would be unique
- Using
.copy()
with Copy-on-Write enabled (ref: PDEP-7: Consistent copy/view semantics in pandas with Copy-on-Write #51463 (comment))