I am trying to create and return a data frame from a python function
def create_df(): data = {\'state\': [\'Ohio\',\'Ohio\',\'Ohio\',\'Nevada\',\'Nevada\'],
when you call create_df() python calls the function but doesn't save the result in any variable. that is why you got the error.
create_df()
assign the result of create_df() to df like this df = create_df()
df
df = create_df()