Skip to content
Advertisement

Tag: numpy

Add in-between steps into array of numbers (Python)

I am looking for some function that takes an input array of numbers and adds steps (range) between these numbers. I need to specify the length of the output’s array. Example: Result: Is there something like that, in Numpy for example? I have a prototype of this function that uses dividing input array into pairs ([0,2], [2,5], [5,8]) and filling

UFuncTypeError: Cannot cast ufunc ‘det’ input from dtype(‘O’) to dtype(‘float64’) with casting rule ‘same_kind’? How to avoid this issue?

I’m trying to build a PDE in python. I’m new to this and wondering where I have gone wrong. Would appreciate some help. I understand that I have a python object and I’m trying to cast it to a float64 but is there any way around this? Here is my error Here is my code Answer A symbolic calculation like

How to Eliminate for loop in Pandas Dataframe in filling each row values of a column based on multiple if,elif statements

Trying to get rid of for loop to speedup the execution in filling values in Column ‘C’ based on if, elif conditions involving multiple columns and rows. Not able to find a proper solution. tried applying np.where with conditions, choices and default values. But failed to get expected results as i was unable to extract individual values from pandas series

Outer product of large vectors exceeds memory

I have three 1D vectors. Let’s say T with 100k element array, f and df each with 200 element array: For each element array, I have to calculate a function such as the following: My first instinct was to use the NumPy outer to find the function with each combination of f and df However, in this case, I am

Compare values within a certain timeframe in arrays

I am trying to compare values (0’s and 1’s) in a array. I want to search for each “1” that appears in one column, for another “1” in the other column in a specific timeframe (for example, 5 seconds, 10 seconds, etc.). I will call the 1’s as “signals”. In example, I have an array such as: data1 = [

Advertisement