When I run:
gini_coef = pysal.inequality.gini.Gini(a).g
where a is any huge numpy array, e.g., with 300000 elements, it gets stuck, irreparably crashing my whole PC, trying to run this line of code (see here):
d = np.abs(np.array([x - xi for xi in x]))
This is not the case when I run it using my own code which does not make use of list comprehensions, and instead calculates Gini like this.
I wrote that just before I discovered you had a Gini function too, so I do not fully understand your code, although I am willing to help. The two functions produce very very similar output (indistinguishable before about 6 decimal places).
Anyway, I thought I would mention that it be worth considering using numpy to calculate the difference.
When I run:
where
ais any huge numpy array, e.g., with 300000 elements, it gets stuck, irreparably crashing my whole PC, trying to run this line of code (see here):This is not the case when I run it using my own code which does not make use of list comprehensions, and instead calculates Gini like this.
I wrote that just before I discovered you had a Gini function too, so I do not fully understand your code, although I am willing to help. The two functions produce very very similar output (indistinguishable before about 6 decimal places).
Anyway, I thought I would mention that it be worth considering using numpy to calculate the difference.