Just wondering if anyone knows if you can create functions and attach them to frame column type in Pandas so they are called automatically when you append or access data.
My scenario - I'm working with non-linear data Decibels, I would like to convert non-linear to a linear form so standard and existing python/pandas math can be used. For example, 80dB + 80dB is ~83.0103dB (-not 160dB).
So what I'm interested in if we can write the "in" and "out" functions and applying them to the column type (say "dB") so they are stored internally as linear data, 80dB = 100000000(in linear form). When you insert or append data the "in" function applied and the "out" function is applied to a dataframe when you access the data. This conversion becomes transparent and allows users to focus on value rather than remembering to do conversions.
Thoughts? Examples?
Much Thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…