KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Let's say I have an class called Star which has an attribute color . I can get color with star.color . But what if I have a NumPy array of these Star objects. What is the preferred way of getting an array of the colors? I can do it with colors = np.array([s.color for s in stars]) But is this the best way to do it? Would be great if I could just do colors = star.color or colors = star->color etc like in some other languages. Is there an easy way of doing this in numpy?
Tags (comma-separated)
Save Edits
Cancel