{"id":20417783,"url":"https://github.com/rhiever/ipython-notebook-workshop","last_synced_at":"2025-07-14T15:07:55.213Z","repository":{"id":146792557,"uuid":"7658423","full_name":"rhiever/ipython-notebook-workshop","owner":"rhiever","description":"Beginner's IPython Notebook Tutorial","archived":false,"fork":false,"pushed_at":"2013-02-11T20:06:42.000Z","size":6202,"stargazers_count":19,"open_issues_count":0,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-11T20:38:02.311Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhiever.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-17T02:40:14.000Z","updated_at":"2018-06-06T15:12:08.000Z","dependencies_parsed_at":"2023-03-24T08:15:44.208Z","dependency_job_id":null,"html_url":"https://github.com/rhiever/ipython-notebook-workshop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rhiever/ipython-notebook-workshop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhiever%2Fipython-notebook-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhiever%2Fipython-notebook-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhiever%2Fipython-notebook-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhiever%2Fipython-notebook-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhiever","download_url":"https://codeload.github.com/rhiever/ipython-notebook-workshop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhiever%2Fipython-notebook-workshop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265311871,"owners_count":23745161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T06:27:25.078Z","updated_at":"2025-07-14T15:07:55.194Z","avatar_url":"https://github.com/rhiever.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# IPython Notebook Workshop\n\nBelow is a compilation of installation instructions and links to various materials that will be useful to anyone using IPython Notebook as a research notebook.\n\n\n## Windows\n\nWindows users have two options for installing IPython Notebook. \u003ca href=\"https://github.com/JorySchossau\"\u003eJory Schossau\u003c/a\u003e has put together \u003ca href=\"https://github.com/JorySchossau/ipynbez#install-and-use\"\u003ea single executable\u003c/a\u003e that installs everything you need for the latest version of IPython Notebook. Alternatively, follow the instructions below to install IPython Notebook with the Enthought Python Distribution.\n\n### Enthought Python Distribution\n\nDownload the free version of the Enthought Python Distribution (EPD): http://www.enthought.com/products/epd_free.php\n\nInstall EPD into the default directory it suggests.\n\nYou now have IPython and most of the libraries you need installed. However, they're mostly older versions, so let's update them real quick.\n\n### Update IPython\n\nLet's get the latest version of IPython so we have the latest and greatest features. Enter the following commands into the Command Prompt, one at a time.\n\n\tenpkg enstaller\n\tenpkg ipython\n\t\nIf it asks you you want to run the executable, click Yes.\n\n### pandas library\n\npandas isn't required for IPython Notebook, but it's the best library in Python for handling data.\n\nEnter the following command into the Command Prompt:\n\n\tenpkg pandas\n\t\nIf it asks you you want to run the executable, click Yes.\n\n### Run IPython Notebook\n\nNow you should be ready to enjoy IPython Notebook! Enter the following command in the Command Prompt to fire it up:\n\n\tipython notebook --pylab=inline\n\n\n\n## Mac and Linux\n\n### Enthought Python Distribution\n\nDownload the free version of the Enthought Python Distribution (EPD): http://www.enthought.com/products/epd_free.php\n\nInstall EPD into the default directory it suggests.\n\n### Update IPython\n\nYou now have IPython and most of the libraries you need installed. However, they're mostly older versions, so let's update them real quick.\n\nEnter the following commands into the Terminal, one at a time. If may ask for your password for the `sudo` command.\n\n\tsudo enpkg enstaller\n\tsudo enpkg ipython\n\t\n### pandas library\n\npandas isn't required for IPython Notebook, but it's the best library in Python for handling data.\n\nEnter the following command into the Command Prompt:\n\n\tsudo enpkg pandas\n\n### Run IPython Notebook\n\nNow you should be ready to enjoy IPython Notebook! Enter the following command in the Terminal to fire it up:\n\n\tipython notebook --pylab=inline\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n# IPython Notebook tips \u0026 tricks\n\nHere are a handful of tips and tricks that I've come across that are helpful for working with IPython Notebook.\n\n## Automatic backup with Dropbox\n\nBacking up your notebooks is crucial to never losing your research notes. Set up a folder in your Dropbox directory (called, say, \"notebooks\") and always run IPython Notebook from there. Whenever you save the changes you made to a notebook, those changes are automatically backed up on Dropbox.\n\n## Mac/Linux users: set up an alias for IPython Notebook\n\nInstead of having to change to the right directory then remembering the proper command to start up IPython Notebook, just make an alias! Edit your ~/.profile and add the following:\n\n\t# change ~/Dropbox/notebooks/ to whatever directory you are storing your notebooks in. I recommend a Dropbox directory!\n\talias ipn=\"cd ~/Dropbox/notebooks/; ipython notebook --pylab=inline\"\n\t\nNow you can just type `ipn` into your command line anywhere, and you'll load IPython Notebook right up!\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n# Learn to mark up text with MarkDown\n\nJohn Gruber put together a \u003ca href=\"http://daringfireball.net/projects/markdown/syntax\"\u003econcise tutorial\u003c/a\u003e explaining how all of the MarkDown language works. I recommend referring to that tutorial whenever you want to figure out how to do something in MarkDown.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n# Learn to code in Python\n\nIf you want to learn how to code in Python, Drs. Bill Punch and Richard Enbody have put together a series of \u003ca href=\"http://www.cse.msu.edu/~cse231/Videos/\"\u003evideo tutorials\u003c/a\u003e covering the core features of the Python language.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n# Practice statistical analysis\n\nAs a part of this workshop, we're going to do a little statistical analysis on some data to get a feel for what IPython Notebook can do.\n\n## Example data file\n\nI have included a data file with this tutorial titled `parasite_data.csv`, courtesy of \u003ca href=\"http://luiszaman.com/\"\u003eLuis Zaman\u003c/a\u003e. Please note that this is unpublished data, and is **only meant to be used for the purposes of this workshop**. Email Luis directly if you want to use it for something else.\n\nThe data file has 3 columns:\n\n* Virulence\n\n* Replicate\n\n* ShannonDiversity\n\nFor our purposes, all we care is that the first two columns (`Virulence` and `Replicate`) are the experimental predictors, and the third column (`ShannonDiversity`) is the measured response from the experiment. Thus, we are interested in what effects `Virulence` and/or `Replicate` have on the measured `ShannonDiversity`. Talk to Luis if you want to know more about the data.\n\nWhat interesting statistical analyses could we do with these data?\n\n## Reading data\n\nRemember when I had you install the `pandas` library? Here's why: it makes reading data files like this ridiculously easy!\n\n```python\nfrom pandas import *\n\n# read data from data file into a pandas DataFrame  \nparasiteData = read_csv(\"https://raw.github.com/rhiever/ipython-notebook-workshop/master/parasite_data.csv\", # name of the data file\n\t\t\tsep=\",\", # what character separates each column?\n\t\t\tna_values=[\"\", \" \"]) # what values should be considered \"blank\" values?\n```\n\nAnd there you have it! It reads in the entire file, and you can do all kinds of neat stuff with the data.\n\n```python\n# display the values for the \"Virulence\" column\nprint parasiteData[\"Virulence\"]\n\n# display the values for the \"ShannonDiversity\" column where \"Virulence\" == 0.5\nprint parasiteData[parasiteData[\"Virulence\"] == 0.5][\"ShannonDiversity\"]\n\n# display the mean \"ShannonDiversity\" for the experiments where \"Virulence\" == 0.7\nprint parasiteData[parasiteData[\"Virulence\"] == 0.7][\"ShannonDiversity\"].mean()\n```\n\npandas DataFrames have all kinds of methods built in, including a bunch of \u003ca href=\"http://pandas.pydata.org/pandas-docs/stable/api.html#api-dataframe-stats\"\u003estatistical functions\u003c/a\u003e and \u003ca href=\"http://pandas.pydata.org/pandas-docs/stable/api.html#id11\"\u003eplotting functions\u003c/a\u003e.\n\n\n## Advanced statistical analysis\n\nIf you need to do something fancier than what pandas offers (and most of us do!), there's most likely a Python library for that.\n\n* \u003ca href=\"http://www.scipy.org/\"\u003escipy\u003c/a\u003e: a TON of statistics functions. Check my \u003ca href=\"http://www.randalolson.com/2012/08/06/statistical-analysis-made-easy-in-python/\"\u003eblog post\u003c/a\u003e for some common useful functions (SEM, bootstrapped 95% confidence intervals, MWW RankSum test, ANOVA, etc.).\n\n* \u003ca href=\"http://statsmodels.sourceforge.net/\"\u003estatsmodels\u003c/a\u003e: linear regression models, generalized linear regression models, etc. Check here if you need to model your data.\n\n* \u003ca href=\"http://scikit-learn.org/stable/\"\u003escikit-learn\u003c/a\u003e: anything machine learning, including data clustering and principle component analysis.\n\n* \u003ca href=\"http://ipython.org/ipython-doc/dev/config/extensions/rmagic.html\"\u003eRmagic\u003c/a\u003e: offers support for all R code. If you prefer to use R, or \u003ca href=\"http://www.randalolson.com/2013/01/14/filling-in-pythons-gaps-in-statistics-packages-with-rmagic/\"\u003eneed an R function that isn't in Python\u003c/a\u003e, you can use Rmagic.\n\nFrom here on out, you're free to explore the example data (or your own). I plan to hold more workshops in the future focusing more specifically on statistical analysis and plotting in IPython Notebook.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n# More useful lessons for scientists\n\nThe folks at Software Carpentry have put together a comprehensive set of \u003ca href=\"http://software-carpentry.org/4_0/index.html\"\u003etutorials\u003c/a\u003e teaching all kinds of useful computational tools and skills for scientists.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhiever%2Fipython-notebook-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhiever%2Fipython-notebook-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhiever%2Fipython-notebook-workshop/lists"}