filtered_df = my_df.loc[my_df['ColA'] == myvalue] #calculated df if len(filtered_df.index) > 0: # if the df has at least one row # your code here