I'm taking machine learning and see myself peeking at the data before building models and so on. I want to have a function to give me the top N sample of the data. Let say I have function sample_data defined like this:
"""print top N of the data
"""
def sample_data (data_name, n):
print ('{}: {}'.format(name_of_the_data_being_passed_to_parameter_data_name, data_name[:n]))
I have tried
eval()
but it didn't work.
I also tried
.__code__.co_varnames
but it returns the parameter names of the function itself, NOT the object being passed.
Is there a way to achieve this? I'm using python 2.7 to match with the class environment.
btw, the object I want to view is pickle file .pkl