To parse data from a CSV or Excel file and plot it with matplotlib. Examples include: parsing local crime data and visualizing how often crime happens on Mondays versus Thursdays, etc.
-
virtualenv You can either download directly, or:
- Mac:
$ sudo easy_install virtualenv - Ubuntu:
$ sudo apt-get virtualenv - Fedora:
$ sudo yum install python-virtualenv - Windows: Download manually
- Mac:
-
virtualenvwrapper You can either download it directly, or:
- Mac:
$ sudo easy_install virtualenvwrapper - Ubuntu:
$ sudo apt-get virtualenvwrapper - Fedora:
$ sudo yum install python-virtualenvwrapper - For Mac, Ubuntu, and Fedora:
$ export WORKON_HOME=~/Envs$ mkdir -p $WORKON_HOME$ source /usr/local/bin/virtualenvwrapper.sh
- Windows: Download manually and follow install instructions
- Mac:
-
Note: If you are running zsh, check out oh-my-zsh. You can easily activate
virualenvandvirtualenvwrapperas a plugin in your.zshrcfile.
Within your terminal
$ cdto get to your 'Home' directory$ mkdir Projects && cd Projectsto create a new 'Projects' folder and move to that directory. You can name it whatever you want, just remember what you named it, and where it is.$ git clone https://github.com/econchick/new-coder.gitThis clones the New Coder project into the directory you're currently in, which is Projects (unless you named it something else).$ cd new-coder/datavizChange into the Data Viz project.$ mkvirtualenv DataVizProjMake a virtual environment specific to your Data Viz project. You should see (DataVizProject) before your prompt, now.(DataVizProject) $ pip install -r requirements.txtNow installing package requirements for this project. Your virtual environment will store the required packages in a self-contained area to not mess up with other Python projects.
Just to show the ease of virtualenv and virtualenvwrapper:
(DataVizProject) $ deactivateYou've deactivated your virtual environment. You will not have access to those packages we've downloaded until we reactivate the virtual environment again.$ workon DataVizProjectThe virtual environment now is reactivated. The packages you previously installed are now accessible. You should see (DataVizProject) before your prompt again.(DataVizProject) $ pip freezeThis will show you the installed packages in this virtual environment.
Don't forget to deactivate your virtual environment after you're all done!
Within your terminal:
(DataVizProject) $ cd new-coder/dataviz/lib/full_source(DataVizProject) $ python dataviz.py --csvfile=<absolute path to csv file> --type=[Days, Type, Map] --delimiter=<csv file delimiter>
Within your terminal:
(DataVizProject) $ cd new-coder/dataviz/lib/tutorial_source- Open the desired file (parse.py, graph.py, or map.py) in a text editor
- Edit the
my_filevariable to the full path of your csv file - Save and return to your terminal
(DataVizProject) $ python [parse.py | graph.py | map.py ]