So you’re / you’ve-been using Python in Windows. You know your way around setting up PATH variable so that you type “python” in your command prompt and it works. Now, say that you want to use Anaconda Python in bash. Let’s go one step further and say, you want to use the bash from your Visual Studio Code integrated shell. The process isn’t too different. There doesn’t seem to exist a guide, which covers all these together – hence this post.
My goal is to show you one of the possible ways to configure your development environment quickly – to you get you going in no time.
At the end you should have the following:
- Bash shell working with python and,
- Visual studio shell integration (optional)
Continue reading “Windows: configure VS Code integrated bash shell for Anaconda”
There is a straight forward way to update an existing or empty directory from given a list of keys. In the first example below, we update dict only with keys, which were not already present. Notice that the key ‘a’ did get change and ‘z’ did not get deleted – they were left alone. The second example, basically initializes an empty dict object. Whereas, the third example creates a new dict object which did not exist before.
Continue reading “Create/Update dictionary form list”
This post tries to answer whether given numbers are comparatively close to each other. This can help if you are using Python for data science or in the area of computer vision doing computing with images. A quick stack-overflow search shows discussion around finding “nearest” value from a set of given values for any given number   . However, there could be a need to limit how much further the nearest number could be. I’d call this limit a “threshold”.
Quite a few times, in my Python (esp. in computer vision related) programming I come across scenarios when I want to tell if the two numbers are close to each other. Some might ask, “Well define close!?” or “How close?”, well … comparatively close.
Now Continue reading “IsClose() in python”
While there are some interesting conversations about numpy.argmin() function’s performance (e.g. here, here and here), Continue reading “numpy.argmin() alternative”
As you already know, in order to calculate non-zero elements in your np array, you can use numpy.count_nonzero. But how about 0? How about an expression? Well, Continue reading “Python Numpy count elements”