John Hunter wrote:
> I have a numpy record array and I want to pretty print a single
> element. I was trying to loop over the names in the element dtype and
> use getattr to access the field value, but I got fouled up because
> getattr is trying to access the dtype attribute of one of the python
>
In addition to Matt's answer:
Yes, we have a tmulti where you can store dates and other variables in a
record-like TimeSeries.
However, there must be simpler:
Why are you using getattr to access the fields ? Your object tr is a record
array, so you could use
for n in tr.dtype.names:
print n,
> I have a numpy record array and I want to pretty print a single
> element. I was trying to loop over the names in the element dtype and
> use getattr to access the field value, but I got fouled up because
> getattr is trying to access the dtype attribute of one of the python
> objects (datetime.
I have a numpy record array and I want to pretty print a single
element. I was trying to loop over the names in the element dtype and
use getattr to access the field value, but I got fouled up because
getattr is trying to access the dtype attribute of one of the python
objects (datetime.date) that