They both run: data = data.iloc[29:, :] This is redundant and results in first 58 lines being removed. - Maybe create variable that will keep track of the minimum number of removed rows and then just removed them all at once.