[SciPy-user] Automatically making a dtype

Pierre GM pgmdevlist@gmail....
Wed Jul 8 20:41:20 CDT 2009


On Jul 8, 2009, at 8:31 PM, Leo Trottier wrote:

> Hi,
>
> So, perhaps I'm the only one, but I find using numpy dtypes can be a  
> bit
> more troublesome than I typically expect from Python libraries.  So  
> I've gone
> ahead and written a little function that, given an "exemplar" (e.g., a
> row from your data set) will create a dtype based on it.

Check np.genfromtxt, the portion of the code dealing w/ dtype is None  
(where the dtype is guessed from the data...)


> Anyone think that something like this should make it into the
> numpy/scipy distribution?  Also, anyone want to improve the function
> so it can handle tuples, sub-arrays, etc?

Well, what are you up to these days ;) ?


More information about the SciPy-user mailing list