# tagged [numpy]

#### Numpy AttributeError: 'float' object has no attribute 'exp'

Numpy AttributeError: 'float' object has no attribute 'exp' Here is my code: And this line gives me error > "AttributeError: 'float' object has no attribute 'exp'". X, t are Numpy ndarray.

#### plus/minus operator for python ±

plus/minus operator for python ± I am looking for a way to do a plus/minus operation in python 2 or 3. I do not know the command or operator, and I cannot find a command or operator to do this. Am I m...

#### Is there a NumPy function to return the first index of something in an array?

Is there a NumPy function to return the first index of something in an array? I know there is a method for a Python list to return the first index of something: Is there something like that for NumPy ...

#### How to multiply individual elements of a list with a number?

How to multiply individual elements of a list with a number? Here `S` is an array How will I multiply this and get the value?

- Modified
- 3 Apr at 09:35

#### How to flatten only some dimensions of a numpy array

How to flatten only some dimensions of a numpy array Is there a quick way to "sub-flatten" or flatten only some of the first dimensions in a numpy array? For example, given a numpy array of dimensions...

#### NumPy array is not JSON serializable

NumPy array is not JSON serializable After creating a NumPy array, and saving it as a Django context variable, I receive the following error when loading the webpage: What does this mean?

#### data type not understood

data type not understood I'm trying to use a matrix to compute stuff. The code is this but I get 'data type not understood', and it works if I do it from terminal.

#### How do I add an extra column to a NumPy array?

How do I add an extra column to a NumPy array? Given the following 2D array: I want to add a column of zeros along the second axis to get:

#### Is there a c# library that provides array manipulation like numpy

Is there a c# library that provides array manipulation like numpy I am starting to use the Numpy and really like it's array handling capabilities. Is there some library that I can use in C# that provi...

#### Index all *except* one item in python

Index all *except* one item in python Is there a simple way to index all elements of a list (or array, or whatever) for a particular index? E.g., - `mylist[3]` will return the item in position 3- `mil...

#### how to convert an RGB image to numpy array?

how to convert an RGB image to numpy array? I have an RGB image. I want to convert it to numpy array. I did the following It creates an array with no shape. I assume it is a iplimage object.

#### Numpy first occurrence of value greater than existing value

Numpy first occurrence of value greater than existing value I have a 1D array in numpy and I want to find the position of the index where a value exceeds the value in numpy array. E.g. Find position i...

#### How to transform numpy.matrix or array to scipy sparse matrix

How to transform numpy.matrix or array to scipy sparse matrix For SciPy sparse matrix, one can use `todense()` or `toarray()` to transform to NumPy matrix or array. What are the functions to do the in...

- Modified
- 31 Jul at 01:48

#### Dropping infinite values from dataframes in pandas?

Dropping infinite values from dataframes in pandas? How do I drop `nan`, `inf`, and `-inf` values from a `DataFrame` without resetting `mode.use_inf_as_null`? Can I tell `dropna` to include `inf` in i...

#### Initialize empty matrix in Python

Initialize empty matrix in Python I am trying to convert a MATLAB code in Python. I don't know how to initialize empty matrix in Python. MATLAB Code: I tried in Python but it gives error:

#### Is it possible to use argsort in descending order?

Is it possible to use argsort in descending order? Consider the following code: This gives me indices of the `n` smallest elements. Is it possible to use this same `argsort` in descending order to get...

#### Test if numpy array contains only zeros

Test if numpy array contains only zeros We initialize a numpy array with zeros as bellow: But how do we check whether all elements in a given n*n numpy array matrix is zero. The method just need to re...

#### How do I create an empty array and then append to it in NumPy?

How do I create an empty array and then append to it in NumPy? I want to create an empty array and append items to it, one at a time. Can I use this list-style notation with [NumPy](http://en.wikipedi...

#### how to convert 2d list to 2d numpy array?

how to convert 2d list to 2d numpy array? I have a 2D list something like and I want to convert it to a 2d numpy array. Can we do it without allocating memory like and then storing values to it?

#### size of NumPy array

size of NumPy array Is there an equivalent to the MATLAB `size()` command in Numpy? In MATLAB, In Python,

#### convert array into DataFrame in Python

convert array into DataFrame in Python When I input the code above, I get this answer: ![enter image description here](https://i.stack.imgur.com/gAZsb.png) But how do I change the column name?

#### numpy, how do I find total rows in a 2D array and total column in a 1D array

numpy, how do I find total rows in a 2D array and total column in a 1D array Hi apologies for the newbie question, but I'm wondering if someone can help me with two questions. Example say I have this,...

#### What exactly does numpy.exp() do?

What exactly does numpy.exp() do? I'm very confused as to what np.exp() actually does. In the documentation it says that it: "Calculates the exponential of all elements in the input array." I'm confus...

- Modified
- 1 Aug at 01:6

#### Mean Squared Error in Numpy?

Mean Squared Error in Numpy? Is there a method in numpy for calculating the Mean Squared Error between two matrices? I've tried searching but found none. Is it under a different name? If there isn't, ...

- Modified
- 4 Aug at 21:0