Create a file

Type in shell/terminal:



nul >

or using echo command

echo. >

mkdir name_of_directory

PATH variable

PATH is an environmental variable

tells which directories to search

for executable files, use echo to see PATH

echo $PATH

add a directory to a PATH variable


export PATH


pip is a package management system


sudo easy_install pip

WIndows - save from this link:

launch file:


Virtual Environment

is a tool to create isolated environment

Mac - Install virtualenv:

sudo pip install virtualenv

or if you get an error:

sudo -H pip install virtualenv

Windows - Install virtualenv:

pip install virtualenv

Open a page in a new window

To open a link in a new window, use:


in the <a href="link> tag

links are defined with the <a> tag

Git Discard, Delete, Unstage

Discard the local changes:

git reset --hard

Stash it, Stashing acts as a stack:

git stash pop

Removing directory from repository:

git rm -rf cached_directory

git rm --cached file

Check version

Check Python version:

python -V

Check Anaconda version:

conda -V

Check all Python libraries:

pip freeze

pip list

reverse vs reverse_lazy

reverse() function:

Like url tag defines a hyperlink by 'name'

reverse_lazy() function:

Prevents error when URL Conf is not loaded

Provides url of a generic class-based view

Often used as success url

success_url = reverse_lazy('name')

Check the error logs for Apache

You can check the error logs for Apache

in /var/log/apache2

tail -20 error.log

This command will return 20 last rows

from error.log

NumPy array

Create NumPy array:


NumPy array is a data structure

more convenient and efficient than a list

Faster in reading and writing

The sum on the NumPy array is 10x faster

than Python list

Change a column name

Change a specified column name in a DataFr

df.rename(columns = {'old':'new'})


df.columns.values[1] = "new"