'Is there a 2-D "where" in numpy?
This might seem an odd question, but it boils down to quite a simple operation that I can't find a numpy equivalent for. I've looked at np.where as well as many other operations but can't find anything that does this:
a = np.array([1,2,3])
b = np.array([1,2,3,4])
c = np.array([i<b for i in a])
The output is a 2-D array (3,4), of booleans comparing each value.
Solution 1:[1]
You can extend the approach in the other answer to get the values of a and b. Given a mask of
c = b > a[:, None]
You can extract the indices for each dimension using np.where or np.nonzero:
row, col = np.nonzero(c)
And use the indices to get the corresponding values:
ag = a[row]
bg = b[col]
Elements of a and b may be repeated in the result.
Solution 2:[2]
Windows uses NTFS filesystem which doesn't have permissions applied in the same way as chmod (ext4) works. There are lots of features missing and features that just work differently.
I'm pretty sure that as long as you're using the same user on your PC, you don't have to be bothered by this. You can probably skip applying chmod commands.
However, i highly recommend you to check out Windows Subsystem for Linux 2.
It is a way to run Linux inside your Windows PC without running a chunky virtual machine (it's very lightweight and fast). Developing PHP with Linux filesystem and kernel is a way better experience. The technology is very mature by now and can even run Docker.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mad Physicist |
| Solution 2 | Riki137 |
