Linked Questions

0 votes
1 answer
267 views

How can I get the unique arrays from such a list below? data =[np.array([ 10, 17]), np.array([ 10, 17]), np.array([ 1, 17, 34]), np.array([ 1, 17, 34]), np.array([ 20, 50, ...
datatech's user avatar
  • 147
3 votes
0 answers
89 views

I have a numpy matrix representing a map of XY coordinates: n = [[0,0],[2,5],[3,1]] Each coordinate is connected to a number of other coordinates, for example: [0,0]:[5,2],[3,7] [2,5]:[1,4] [3,1]:[3,...
ablarry91's user avatar
330 votes
20 answers
289k views

How do we decide on the best implementation of hashCode() method for a collection (assuming that equals method has been overridden correctly) ?
Omnipotent's user avatar
  • 28.3k
226 votes
4 answers
97k views

I've implemented a BloomFilter in python 3.3, and got different results every session. Drilling down this weird behavior got me to the internal hash() function - it returns different hash values for ...
redlus's user avatar
  • 2,531
60 votes
5 answers
43k views

My goal is to get unique hash value for a DataFrame. I obtain it out of .csv file. Whole point is to get the same hash each time I call hash() on it. My idea was that I create the function def ...
mkurnikov's user avatar
  • 1,701
28 votes
3 answers
17k views

Implementing a system where, when it comes to the heavy mathematical lifting, I want to do as little as possible. I'm aware that there are issues with memoisation with numpy objects, and as such ...
Bolster's user avatar
  • 7,996
18 votes
4 answers
14k views

I have 2 fixed width files like below (only change is Date value starting at position 14). sample_hash1.txt GOKULKRISHNA 04/17/2018 ABCDEFGHIJKL 04/17/2018 111111111111 04/17/2018 sample_hash2.txt ...
goks's user avatar
  • 1,206
14 votes
2 answers
16k views

One way to make a numpy array hashable is setting it to read-only. This has worked for me in the past. But when I use such a numpy array in a tuple, the whole tuple is no longer hashable, which I do ...
Demento's user avatar
  • 4,317
8 votes
3 answers
8k views

I have an ordinary Python list that contains (multidimensional) numPy arrays, all of the same shape and with the same number of values. Some of the arrays in the list are duplicates of earlier ones. ...
SoItBegins's user avatar
7 votes
2 answers
918 views

I have a class A with three attributes a,b,c, where a is calculated from b and c (but this is expensive). Moreover, attributes b and c are likely to change over times. I want to make sure that: a is ...
Tashi Walde's user avatar
2 votes
4 answers
3k views

Is there a way to represent a 3D Vector as a definite number? I mean that two vectors with different values can't ever have the same hash value. I'm sure there already is a question about this but I ...
borchero's user avatar
  • 6,092
2 votes
1 answer
3k views

What I'm trying to do is provide a GUI for displaying some numpy arrays, and wire up IPython so you can manipulate the data however you like. I have all the IPython stuff working, the problem is how ...
Cuadue's user avatar
  • 3,969
1 vote
1 answer
1k views

In python/numpy, I have a 10,000x10,000 array named random_matrix. I use md5 to compute the hash for str(random_matrix) and for random_matrix itself. It takes 0.00754404067993 seconds on the string ...
mlstudent's user avatar
  • 959
3 votes
1 answer
5k views

I want to hash numpy arrays without copying the data into a bytearray first. Specifically, I have a contiguous read-only two-dimensional int64 numpy array A with unique rows. To be concrete, let's ...
Erik's user avatar
  • 7,522
8 votes
1 answer
924 views

I encountered a strange behavior of np.ndarray.tobytes() that makes me doubt that it is working deterministically, at least for arrays of dtype=object. import numpy as np print(np.array([1,[2]])....
normanius's user avatar
  • 9,959

15 30 50 per page