Help: how to connect a slider to a function that calculates the percentage in specific columns of a data frame

Hi, I would like to use a slider to apply a percentage increase calculation on specific columns of a data frame, once I create the function, what is the best way to connect to a slider? The slider will be built with specific % numbers: 5% - 10% - 20%. Happy to hear your help. Thanks a lot, Marcello PS: Streamlit is GREAT!!

Hi @marcello-calabrese , whenever the slider value changes, you could use the dataframe apply function to update your calculations.

(You could also explore revising the dataframe via a callback)

Cheers

Thanks Shawn,

How does it work with call back? Sorry if I ask basic questions. So let’s say I have the function that calculates the % increase, how I can do it with callaback and slider?

function to calculate the % Increase and apply to columns (writte in pseudo code)

def inc_pct(df, pct, column,):

Inc_pct()

Best,

Marcello