I try to get the min and max value (as a float) of a column without the zero values.
I tried:
minValue = df[df['col1']>0.1].min()
maxValue = df['col2'].max()
type minValue --> pandas.core.series.Series
type maxValue --> float
CodePudding user response:
I'd suggest:
minValue = df.col1[df.col1!=0].min()
maxValue = df.col1[df.col2!=0].max()
but you need to adapt to the columns you want to look for non-zero values and from which you want the min/max values.
CodePudding user response:
You can try
minValue = df.loc[df['col1']>0.1, 'col1'].min()