i want to print a column of a dataframe in a function. it says name 'data' is not defined. How do I make it global?
my function is:
def min_function():
print("Choose action to be performed on the data using the specified metric. Options are list, correlation")
action = input()
if action == "list":
print("Ranked list of countries' happiness scores based the min metric")
print(data['country'], data.sort_values(['min_value'], ascending=[0,0]))
data is my dataframe.