Get min & max values of a slider based on min and max values of a given dataframe column?

Hi guys!

Thanks for this brilliant tool! I’m now using it every day!

As I can’t find any info in the manual, I would like to know if it’d be possible to get min & max values of a slider based on min and max values in a dataframe column?

I’ve pasted some code below for context.

Thanks!

import pandas as pd


matrix = [(22, 16, 23),
(33, np.NaN, 11),
(44, 34, 11),
(55, 35, np.NaN),
(66, 36, 13)
]

df = pd.DataFrame(matrix, index=list('abcde'), columns=list('xyz'))

maxValue = df['y'].max()
minValue = df['y'].min()

print("Maximum value in column 'y': " , maxValue)
print("Maximum value in column 'y': " , minValue)

QRatio = st.slider('value', maxValue, minValue)

I think the issue here is just that you have the arguments in the incorrect order. Changing this line to QRatio = st.slider('value', minValue, maxValue) makes it work locally for me.

Cheers Randy!