I just am having a problem with NumPy dtypes. Essentially I\'m trying to create a table that looks like the following (and then save it using rec2csv):
The following code might help:
import numpy as np
dt = np.dtype([('name1', '|S10'), ('name2', '
Your immediate problem was that np.dtype expects the format specifiers to be numpy types, such as '|S10' or 'str or float. If you type help(np.dtype) you'll see many examples of how np.dtypes can be specified. (I've only mentioned a few.)
Note that np.array expects a list of tuples. It's rather particular about that.
A list of lists raises TypeError: expected a readable buffer object.
A (tuple of tuples) or a (tuple of lists) raises ValueError: setting an array element with a sequence.