yt_arr = YTArray([]) for i in range(10): yt_arr.append(i)
This particular type of code returns an error saying that YTArray has no attribute append. So how do I append values in the array?
YTArray
append
You can append the contents to a list and later convert it to a YTArray object.
list
arr = [] yt_arr = YTArray([]) for i in range(10): arr.append(i) yt_arr = YTArray(arr,'cm') # add your symbolic reference here
You can append the contents to a
listand later convert it to aYTArrayobject.