Is there any way to return a list or tuple when referencing a pandas DF? get_df() is a pandas column with a couple hundred float values. The code below is asking to return the values greater than 6000 and less than 7000. Can I return a list to my method? (I know I can print this but that is not what I am trying to do)
def mass_needed(numb_one, numb_two):
for i in get_df():
if i > numb_one and i < numb_two:
return(i)
print(mass_needed(6000, 7000))
What I am trying to accomplish is I want to be able to use a for loop to return a list or series to my call mass_needed() method. I do understand that when the loop reads return, it stops the code, but I get an error when I put the return line outside of the for loop. Is there any advice on how I can achieve a list using this specific method?