3 ms·
Many axis=1 operations in pandas do a transpose under the hood, mind you. Axis=1 belongs in matrices, not in heterogeneous data. They are a performance footgun.
by ritchie46 3y ago
Many axis=1 operations in pandas do a transpose under the hood, mind you. Axis=1 belongs in matrices, not in heterogeneous data. They are a performance footgun. We make the transpose explicit.
- Galanwe 3y ago> Many axis=1 operations in pandas do a transpose under the hood, mind you Sure, but many others are natively axis=1-aware and avoid full transposition. > Axis=1 belongs in matrices, not in heterogeneous data. I'm not sure to understand what that means. Care to elaborate? > They are a performance footgun. You don't get to only solve the problems that are efficient to solve... > We make the transpose explicit. Yes, but when you do mixed time series / cross sectional computations, you cannot always untangle both dimensions and transpose once. Sometimes your computation intrinsicely interleaves cross sectional and time series. In these case, which happen a lot in financial computations, then explicitly fully transposing is very slow.