I have a list of DataFrames i.e data = [df1,df2,df3.....dfn] . I am trying to iterate function maxloc through list of data and appending new values to new_max. It gives me following error TypeError: 'int' object is not iterable. How can I fix it?
def max(data):
data['loc_max'] = np.zeros(len(data))
for i in range(1,len(data)-1):
if data['value'][i] >= data['value'][i-1] and data['value'][i] >= data['value'][i+1]:
data['loc_max'][i] = 1
return data
def maxloc(data):
loc_opt_ind = argrelextrema(df['values'].values, np.greater)
loc_max = np.zeros(len(data))
loc_max[loc_opt_ind] = 1
data['loc_max'] = loc_max
return data
new_max= []
for df in range(len(data)):
max_values = maxloc(df).loc_max
new_max.append(max_values)