I want to group some list of number by creating a function that converts list of numbers into group then convert these numbers into pandas dataframe but it is not working.
List = [ 10, 50, 80, 12, 5, 8, 19, 90, 40, 8, 7, 9, 18, 27, 30, 45]
def number_group(x):
item = [ ]
for i in x:
if i in range(0, 30):
print (' group 10 and 30')
elif i in range(30, 60):
print ('group 30 and 60')
elif i in range (60, 90):
print ('group 60 and 90')
elif i in range (90, 120):
print ('group 90 and 120')
else:
return ('NAN')
item.append((i))
return
When i pass my the list into the function and try converting the result into panda dataframe i keep getting none. Any idea how these can be done?