I'm working with some data, and just writing lines in sequence works fine and gives me the results I want (to extract a row of data from the date from the dataframe 'restaurant'):
orders = restaurant[(restaurant.index == date)]
However, when I put this into a function, it no longer is able to look it up by date, and instead just gives me a blank data frame:
def datesearch(date)
orders = restaurant[(restaurant.index == date)]
return orders
I can't seem to figure out why it's fine outside the function, but for some reason, it can't search by the date when I put it in a function.
datesearch(date). Are you getting an error message?orders = datesearch(date)?