recarray Questions

3

Solved

I just want to get a list or dict from dtype out of a numpy array. Thought it would be a easy but it is not itterable. I looked other places but could not find answer. jn is a recarray [OrderedDi...
Fornof asked 14/2, 2014 at 10:42

7

Solved

I have a starting array such as: [(1, [-112.01268501699997, 40.64249414272372]) (2, [-111.86145708699996, 40.4945008710162])] The first column is an int and the second is a list of floats. I need...
Eldrid asked 21/8, 2014 at 13:9

5

Solved

I have a fairly simple question about how to sort an entire array/recarray by a given column. For example, given the array: import numpy as np data = np.array([[5,2], [4,1], [3,6]]) I would lik...
Lambeth asked 26/7, 2011 at 19:38

5

Solved

The answer will be very obvious I think, but I don't see it at the moment. How can I convert a record array back to a regular ndarray? Suppose I have following simple structured array: x = np.array...
Trinette asked 10/5, 2011 at 22:49

3

Solved

I know there was already a question about this topic (cleanest way to add a field to a structured numpy array), see Adding a field to a structured numpy array but I have a question about the ans...
Mcgarry asked 13/3, 2011 at 10:16

1

Solved

I have a recarray that comes from reading a csv file. I am interested in converting a subset of columns to a continuous float array. I'd like to avoid converting them to list or stacking them one b...
Unchain asked 14/4, 2015 at 13:49

1

Solved

I am attempting to create a function in cython that accepts a numpy structured array or record array by defining a cython struct type. Suppose I have the data: a = np.recarray(3, dtype=[('a', np.f...
Dosi asked 29/1, 2014 at 15:26

1

Solved

If we have a Numpy recarray: x = np.array([(1.,2.)], dtype=np.dtype([('a','<f8'),('b','<f8')])) We can access its fields in Python as: x['a'] or x['b'] But if this array is passed to a C prog...
Fisch asked 1/10, 2013 at 19:14

2

Solved

I have a Numpy rec array from which I would like to do some quick queries similar to SQL: SELECT * where array['phase'] == "P". I would like to get a Record Array as output with each row correspond...
Hub asked 6/9, 2011 at 0:15

1

Solved

I have a structured numpy array, and I am sorting it by a order. It works pretty fine but in just one direction! Descending: sort(myStructuredArray,order=my_order)[::-1] and Ascending: sort(m...
Nummary asked 12/4, 2013 at 13:23

3

Solved

Suppose I make two recarrays with the same dtype and stack them: >>> import numpy as np >>> dt = [('foo', int), ('bar', float)] >>> a = np.empty(2, dtype=dt).view(np.rec...
Ornithischian asked 24/11, 2009 at 17:54

1

Solved

Let's say I have some simple data y = [[datetime.datetime( 2012,1,1,1,1), 2.1], [datetime.datetime( 2012,1,1,1,2), -3.1], [datetime.datetime( 2012,1,1,1,3), 0.1]] and I want a numpy record ar...
Stream asked 5/4, 2012 at 16:57

2

Solved

I wonder what the best way of normalizing/standardizing a numpy recarray is. To make it clear, I'm not talking about a mathematical matrix, but a record array that also has e.g. textual columns (su...
Elamitic asked 19/3, 2012 at 18:27

1

Solved

Is it possible to initialise a numpy recarray that will hold strings, without knowing the length of the strings beforehand? As a (contrived) example: mydf = np.empty( (numrows,), dtype=[ ('file_n...
Copland asked 2/2, 2012 at 7:57

1

I'm trying to retrieve the column titles of a recarray, and running into considerable trouble. If I read in a .csv file using pylab's csv2rec function, I am able to access column titles in the foll...
Grammalogue asked 16/12, 2011 at 6:39

2

Solved

I'm trying to subset the records in a numpy.recarray based on the common values between one of the recarrays fields and an external array. For example, a = np.array([(10, 'Bob', 145.7), (20, 'Sue'...
Chock asked 10/3, 2011 at 19:1

3

Solved

I would like to subclass numpy ndarray. However, I cannot change the array. Why self = ... does not change the array? Thanks. import numpy as np class Data(np.ndarray): def __new__(cls, inputar...
Villareal asked 1/3, 2011 at 0:38

1

Solved

The following example shows what I want to do: >>> test rec.array([(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0)], dtype=...
Cannibalism asked 17/6, 2010 at 2:55
1

© 2022 - 2024 — McMap. All rights reserved.