-3

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))
4
  • 4
    You need to post a complete minimal reproducible example. Commented Nov 14 at 16:34
  • 3
    numpy.ndarray objects to not have a my_list attribute. That's exactly what the exception is telling you Commented Nov 14 at 16:41
  • What do you expect g1_fp1_arr.my_list() to be? Commented Nov 15 at 2:45
  • you probably meant .tolist() .. you might also prefer numpy.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 Commented 2 days ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.