I am kind of new in Object Oriented programming. I am reviewing a code and there is a part that I have difficulty to understand. I do appreciate if you can help me.
I have a code in which we have numpy array and then it seems "array" is used as attribute or method for the the numpy array but I am not sure how it does work. Following is the syntax that I have:
self.PromotionIdData.array()[self.ID,t] = ...
PromotionIdData is a two-dimensional numpy array. But I can not generate the similar syntex for myself. here is my code:
import numpy as np
from array import *
class test:
def __init__ (self):
self.price=np.array([10,20,30])
self.cost=20
self.volum=2
a=test()
print getattr(a,'price').array[1]
But my code does not work. I got the error indicating "array" is not an attribute.
Thanks,
nparray.array()[i]
andnparray.array[i]
? – jazzpi Nov 27 '13 at 18:51