All Questions
1,818 questions
1
vote
2
answers
100
views
Large number in python gives infinity
I dealing with data with very large numbers this error appears
for example if I am trying to calculate for example:
import random
import numpy as np
import cmath
import math
import mpmath
from scipy....
0
votes
2
answers
113
views
Making a Diagonal matrix with desired shape
How to make a random elements digonal matrix in a numpy array with the desired shape, for example I want to make F to be a numpy array with shape (3, 2, 4, 4), and the diagonal matrix dimensions 4*4 ...
0
votes
2
answers
152
views
List comprehension instead of using append in for loop
I want to use list comprehension instead of using append method because it make the code runs faster however when it is a numpy array it doesn't work.
import numpy as np
a = np.array([1, 2 , 4])
b = ...
0
votes
2
answers
83
views
How to make a np.array of N diagonal matrices
I want to make an array of N diagonal matrices with M dimension, for example for N=2 and M=3,
the array should be like this: np.array([[[1, 0, 0],[0, 2, 0],[0, 0, 3]],
[[5, 0, 0],[0, 6, 0],[0, 0, 7]]])...
0
votes
1
answer
36
views
Difference in Outputs when viewing an array in Python 2.7
Here I have 1 column of my MATLAB Data:
raw_data
10
-2.77738418373534e+242
3.68340627929942e+23
-1.66594278761299e+94
NaN
-2.77738418373534e+242
3.68340627929942e+23
-1.66594278761299e+94
NaN
2....
-5
votes
2
answers
2k
views
In Python in what ways can u make an empty NumPy array? [closed]
(https://i.sstatic.net/eakU9.jpg)
To make an empty Numpy the array
0
votes
2
answers
40
views
How to set different values of the elements of a np.arrays to different values in Python 3.8?
Let I have the following np.array:
>>>a=np.array([20, 10,5,10,5,10])
>>>array([20, 10, 5, 10, 5, 10])
Now, I want to replace 20 and 10 by 1 and 5 by 0.
Is there a function that ...
0
votes
0
answers
44
views
(Python) just locate few corners of img (now I could locate all corner) that I want to know the setting the filter the output I want
(Python) just detect few corners instead of all from img, to optimize the speed
My main purpose is to cut the original img in sticker size, and recognize img to text, find if is duplicate or print ...
0
votes
0
answers
32
views
create a dictionary from two lists based on correct indexing [duplicate]
I have two arrays, lets say L1 and L2 takes the following form.
L1 = array([2, 3, 5, 2, 5, 2, 3])
L2 = array([1.2, 3.3, 5.7, 1.6, 5.5, 1.5, 3.4])
Now I want to create a dictionary in the following ...
-3
votes
1
answer
143
views
How to shuffle a list with specific order ? and i also want user input and simple solution
Write a program to have a function called triple_shuffle () that takes three lists of the same size and shuffles them concurrently.
Given list like [10,20,30,40,50], [11,22,33,44,55], and [19,18,17,16,...
5
votes
1
answer
615
views
parsing a conditional from a string
I have two numpy arrays a, b and a string of the form s = "1.5 * b if 2*a > 7 else a + b"
I would like to create an array c, which will evaluate the string on the arrays in an efficient ...
0
votes
1
answer
149
views
Find IP address in multiple text files and replace it with another string in Python with regex
I have multiple text files as below:
I want to read all of the text files and find the IP value in each file and replace it with the noresult string which is available in the text and save per file in ...
0
votes
1
answer
130
views
Find IP address string in multiple text files and add it to the relevant rows in Python
I have multiple txt files with below details:
Text File1:
Id = 0005
Cause = ERROR
Code = 307
Event Time = 2020-11-09 10:16:48
...
0
votes
2
answers
45
views
Convert One Single row to Multiple Columns based on Categorization in Python
I have a txt file as below. the dataset has the below template, I want to convert this dataset in to 6 columns with Id, Cause, Code, Event Time, Severity and Severity Code headers in python:
Id ...
0
votes
1
answer
3k
views
convert number from numpy.float64 to integer
I have the following dataframe:
edad id_tipo_propiedad
0 NaN 2
1 NaN 2
2 NaN 2
3 NaN 2
4 NaN ...