Permanently add a directory to PYTHONPATH?

You need to add your new directory to the environment variable PYTHONPATH, separated by a colon from previous contents thereof. In any form of Unix, you can do that in a startup script appropriate to whatever shell you’re using (.profile or whatever, depending on your favorite shell) with a command which, again, depends on the … Read more

How is Anaconda related to Python?

Anaconda is a python and R distribution. It aims to provide everything you need (Python-wise) for data science “out of the box”. It includes: The core Python language 100+ Python “packages” (libraries) Spyder (IDE/editor – like PyCharm) and Jupyter conda, Anaconda’s own package manager, used for updating Anaconda and packages Your course may have recommended … Read more

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

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