I've a user defined function as follows:-
def genre(option,option_type,*limit):
option_based = rank_data.loc[rank_data[option] == option_type]
top_option_based = option_based[:limit]
print(top_option_based)
top_option_based.to_csv('top_option_based.csv')
return(top_option_based))
please refer thisimage
when I use the function as
genre('genre','Crime',2)
I'm getting an error as
TypeError: cannot do slice indexing on <class 'pandas.indexes.numeric.Int64Index'> with these indexers [(2,)] of <class 'tuple'>".