Hi everyone,
I've looked in the mailing list archives and with the googles, but haven't yet
found any hints with this question...
I have a float field in a NumPy record that looks like it's being substituted
as a string in the Python {:f}.format() mini-language, thus throwing an error:
In
You can treat a record in a record array like a tuple or a dictionary when
it comes to formatting. So, either refer to the index element you want
formatted as a float, or refer to it by name (in the formatting language).
By just doing {:f}, you are just grabbing the first one, which is XXYYZZ
and
On Thu, Jun 6, 2013 at 8:48 PM, Maccarthy, Jonathan K jkm...@lanl.gov wrote:
Hi everyone,
I've looked in the mailing list archives and with the googles, but haven't
yet found any hints with this question...
I have a float field in a NumPy record that looks like it's being substituted
as a
I would like to create an array object and initialize the array's
values with an arbitrary fill value, like you can do using the ones()
and zeros() creation routines to create and initialize arrays with
ones or zeros. Is there an easy way to do this? If this isn't
possible then what is the most
On Thu, Jun 6, 2013 at 8:56 PM, James Adams monoco...@gmail.com wrote:
I would like to create an array object and initialize the array's
values with an arbitrary fill value, like you can do using the ones()
and zeros() creation routines to create and initialize arrays with
ones or zeros. Is
Ah, so np.int64 and np.str inherit the native Python __format__(), but
np.float32/64 doesn't get __builtin__.float.__format__(). That's not
intuitive, but I see now why this works:
In [8]: '{:6.6s} {:8d} {:11.6f}'.format(tmp.sta, tmp.ondate, float(tmp.lat))
Out[8]: 'XYZZ2001123
On Thu, Jun 6, 2013 at 9:18 PM, Maccarthy, Jonathan K jkm...@lanl.gov wrote:
Ah, so np.int64 and np.str inherit the native Python __format__(), but
np.float32/64 doesn't get __builtin__.float.__format__(). That's not
intuitive, but I see now why this works:
In [8]: '{:6.6s} {:8d}
I'm really showing my ignorance now, I think; so, the old-style fmt %
(tuple) must use a different mechanism, and perhaps that's why np.savetxt
never choked on a float32 for me before (yes, I am on a 64-bit system).
In [8]: type(tmp.lat)
Out[8]: numpy.float32
In [9]: '%6s %8i %11.6f' %
On Thu, Jun 6, 2013 at 9:50 PM, Maccarthy, Jonathan K jkm...@lanl.gov wrote:
I'm really showing my ignorance now, I think; so, the old-style fmt %
(tuple) must use a different mechanism, and perhaps that's why np.savetxt
never choked on a float32 for me before (yes, I am on a 64-bit system).
James Adams wrote:
I would like to create an array object and initialize the array's
values with an arbitrary fill value, like you can do using the ones()
and zeros() creation routines to create and initialize arrays with
ones or zeros. Is there an easy way to do this? If this isn't
Hi Ralf,
Your post comes just on time! I implemented the memory managed arrays and
noticed a serious problem with my capsule creation code (post I sent to the
list about the update on the 12th of March in reply to Bill Spotz Request
code review of numpy.i changes). For some reason, the code I
11 matches
Mail list logo