I'm trying to write a code with the objective to determine the fixed point of a nonlinear system. The code can determine the fixed points but there exixts few "None" values which when removed, generates varied array length of data. Hence, I tried to use padding. But it generates error which says
AttributeError: 'numpy.ndarray' object has no attribute 'my_list'
The code as below
g1_fp1_arr = pad_list(g1_fp1_arr.my_list(), max_len)
g1_fp2_arr = pad_list(g1_fp2_arr.my_list(), max_len)
g1_mean = pad_list(g1_mean.my_list(), max_len)
g1_diff = pad_list(g1_diff.my_list(), max_len)
g2_fp_arr = pad_list(g2_fp_arr.my_list(), max_len)
def pad_list(lst, length):
return lst + [np.nan] * (length - len(lst))
my_listattribute. That's exactly what the exception is telling youg1_fp1_arr.my_list()to be?.tolist().. you might also prefernumpy.pad()with similar logic to what you have stackoverflow.com/questions/38191855/zero-pad-numpy-array , then calling.tolist()on the result or leave it as a NumPy array