recarray « numpy « Python Data Type Q&A

Home
Python Data Type Q&A
1.array
2.date
3.dictionary
4.Format
5.integer
6.List
7.numpy
8.regex
9.string
10.tuple
Python Data Type Q&A » numpy » recarray 

1. Combining two record arrays    stackoverflow.com

I have two Numpy record arrays that have exactly the same fields. What is the easiest way to combine them into one (i.e. append one table on to the other)?

2. Calculating conditional probabilities from joint pmfs in numpy, too slow. Ideas? (python-numpy)    stackoverflow.com

I have a conjunctive probability mass function array, with shape, for example (1,2,3,4,5,6) and I want to calculate the probability table, conditional to a value for some of the dimensions (export ...

3. Python Numpy Structured Array (recarray) assigning values into slices    stackoverflow.com

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, ...

4. Converting (part of) a numpy recarray into a 2d array?    stackoverflow.com

We've got a set of recarrays of data for individual days - the first attribute is a timestamp and the rest are values. Several of these:

    ts  ...

5. Create a new array from numpy array based on the conditions from a list    stackoverflow.com

Suppose that I have an array defined by:

data = np.array([('a1v1', 'a2v1', 'a3v1', 'a4v1', 'a5v1'),
       ('a1v1', 'a2v1', 'a3v1', 'a4v2', 'a5v1'),
       ...

6. Modifying an advanced-indexed subset of a NumPy recarray in place    stackoverflow.com

I have a recarray with a couple columns that I use for selecting a subset. Something like

>>> x
   array([ ('label1',True,3),
          ...

7. numpy structured arrays: help understanding output    stackoverflow.com

I am trying to learn how to use numpy's structured arrays. Specifically, I was trying to add information to more than one field at a time. I tried:

import numpy as np

numrec ...

8. Adding a field to a structured numpy array (2)    stackoverflow.com

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 ...

9. masked arrays in numpy error    stackoverflow.com

I input a file using genfromtxt and some of the values are missing so I generate a masked array. When I try to index some of the values of the ...

10. Convert structured array to normal nd array    stackoverflow.com

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 normal nd array? Suppose I have ...

11. Select Rows from Numpy Rec Array    stackoverflow.com

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 ...

12. How to convert numpy.recarray to numpy.array?    stackoverflow.com

What's the best way to convert numpy's recarray to a normal array? i could do a .tolist() first and then do an array() again, but that seems somewhat inefficient.. Example:

import numpy as np
a ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.