What is setup.py?

setup.py is a python file, the presence of which is an indication that the module/package you are about to install has likely been packaged and distributed with Distutils, which is the standard for distributing Python Modules. This allows you to easily install Python packages. Often it’s enough to write: pip will use setup.py to install … Read more

How can I sandbox Python in pure Python?

This is really non-trivial. There are two ways to sandbox Python. One is to create a restricted environment (i.e., very few globals etc.) and exec your code inside this environment. This is what Messa is suggesting. It’s nice but there are lots of ways to break out of the sandbox and create trouble. There was … Read more

ImportError: No module named pandas

I am trying to write code in Python to fetch Twitter data, and I am not getting an error for twython. But I am getting an error for Pandas. I have installed Pandas using pip install pandas. But I still get the following error. How can I fix it?

Maximum and Minimum values for ints

Python 3 In Python 3, this question doesn’t apply. The plain int type is unbounded. However, you might actually be looking for information about the current interpreter’s word size, which will be the same as the machine’s word size in most cases. That information is still available in Python 3 as sys.maxsize, which is the maximum value representable by … Read more

Conda command not found

If you’re using zsh and it has not been set up to read .bashrc, you need to add the Miniconda directory to the zsh shell PATH environment variable. Add this to your .zshrc: Make sure to replace /home/username/miniconda with your actual path. Save, exit the terminal and then reopen the terminal. conda command should work.

Cannot find module cv2 when using OpenCV

First do run these commands inside Terminal/CMD: Then the issue for the instruction below will be resolved For windows if you have anaconda installed, you can simply do or if you are on linux you can do : or Link1 Link2 For python3.5+ check these links : Link3 , Link4 Update:if you use anaconda, you may simply use this … Read more

Modifing data while using iterrows() does not work

The code doesn’t work because: (source) Depending on the data types, the iterator returns a copy and not a view, and writing to it will have no effect. To write to it, you can try to see if at works, i.e., Just modifying something while you’re iterating over it is not recommended. But I think it should … Read more