so i have this func that creates a variable of a range and the name of the range itself.
for example: key: range(0,5) , val = '0-5'
due to reasons of dynamical allocation i want to send df.apply with the function and a calculated variable to use with.
how should i do it?
def appsgroup(a,length):
apps_grouper = {}
for i in range(0,length,length//20):
apps_grouper[range(i ,i+length//20)] = '{0}-{1}'.format(i,i+length//20)
for key, val in apps_grouper.items():
if a in key:
return val
length= len(set(Grouped.apps.values))
Grouped['apps2'] = Grouped.apps.apply(appsgroup, length ?)