Python Forum
Syntax to print ndarray member of class containing ndarray
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax to print ndarray member of class containing ndarray
#7
(Jul-09-2020, 05:37 AM)ndc85430 Wrote: Remember that ndarray objects can contain objects of basically any other type, so it's up to the programmer to know what type is in them and how to deal with them. Therefore, you have to go over all of the items and do your printing as you are, or transform the ndarray of Qs into an ndarray of whatever type Q.s is. With Python lists, you'd use map or, like you say, a list comprehension to do that transformation, but I don't know the API for ndarray well enough to know which method to use (there doesn't seem to be a map).

Thanks for the advice. I'm going to have to chew on that for a while and do some more RTFM. I discovered numpy.nditer for iterating over an ndarray, but there are issues specifying just the Q.s member of each element of the gx.g ndarray while ignoring the Q.qs member.

I'll reply again after I do more research.

Peter
Reply


Messages In This Thread
RE: Syntax to print ndarray member of class containing ndarray - by pjfarley3 - Jul-09-2020, 06:29 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Class member become static Quasar999 1 683 Sep-16-2023, 12:52 PM
Last Post: deanhystad
  print(data) is suddenly invalid syntax db042190 6 1,214 Jun-14-2023, 02:55 PM
Last Post: deanhystad
  AttributeError: 'numpy.ndarray' object has no attribute 'load' hobbyist 8 7,144 Jul-06-2022, 10:55 AM
Last Post: deanhystad
  labels.append(self.classes.index(member.find('name').text)) hobbyist 1 1,933 Dec-15-2021, 01:53 PM
Last Post: deanhystad
  invalid syntax in my class CompleteNewb 2 1,924 Dec-13-2021, 09:39 AM
Last Post: Larz60+
  Tuple generator, and function/class syntax quazirfan 3 3,900 Aug-10-2021, 09:32 AM
Last Post: buran
  How can I pass&return ndarray between python and c++? JESuh 0 1,787 Mar-09-2021, 08:29 AM
Last Post: JESuh
  How to define a variable in Python that points to or is a reference to a list member JeffDelmas 4 2,664 Feb-28-2021, 10:38 PM
Last Post: JeffDelmas
  Invalid syntax on print function DoctorSmiles 2 2,824 Jul-12-2020, 07:39 PM
Last Post: DoctorSmiles
  Function to return list of all the INDEX values of a defined ndarray? pjfarley3 2 1,978 Jul-10-2020, 04:51 AM
Last Post: pjfarley3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020