Skip to content

Commit 9f0d6dd

Browse files
committed
lots o things
1 parent ae9a310 commit 9f0d6dd

File tree

10 files changed

+5925
-3
lines changed

10 files changed

+5925
-3
lines changed

0 Jupyter Intro.ipynb

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Welcome to Jupyter Notebooks\n",
8+
"\n",
9+
"[Jupyter][1] notebooks have become very popular in recent years. They allow you to combine code, text, visualizations and other web-based elements all in a single place and are great for collaboration.\n",
10+
"\n",
11+
"### Notebook basics\n",
12+
"A notebook is composed of cells. There are two main types of cells - **code** and **markdown**. Each cell defaults to a code cell that is capable of running Python (or the chosen kernel). The cell you are looking at right now is a markdown cell. Markdown cells are used whenever text or images need to be embedded into the notebook such as this explanation that you are reading. Code cells are denoted with `In [ ]` and if they produce output have `Out [ ]` directly underneath.\n",
13+
"\n",
14+
"There are two modes for all cell types - **edit** and **command**. Edit mode allows you to physically modify the contents of the cell by typing. This cell that you are currently reading is in command mode. \n",
15+
"\n",
16+
"How to tell which mode you are in? There are two ways. If the outline of the cell is **blue** then you are in command mode and if its **green** then you are in edit mode. Also, if you are in edit mode a small pencil will appear in the top right corner of this notebook to the left of the name of the kernel, which happens to be 'Python 3' in this case. Only one cell is **active** at all times and that is the one that is outlined in blue/green. \n",
17+
"\n",
18+
"In command mode, the keys do not write any contents to the cells. Instead, the do special actions. For instance, if this current cell is highlighted blue (which means its in command mode) press the key **B**. This adds a new cell directly below this one. Click back on this cell so that its highlighted blue again.\n",
19+
"\n",
20+
"#### Switching between edit mode and command mode\n",
21+
"To enter **edit** mode press **enter** in an active cell. Alternatively, **double click** somewhere inside this cell, which will first reveal the markdown and then click anywhere you'd like to edit. You will know you are in edit mode when the cell outline is green, the pencil appears in the top right corner, have your normal blinking cursor and you keyboard allows you to modify the content of the cells.\n",
22+
"\n",
23+
"To return the markdown cell back to command mode, you can **run** the cell by pressing **shift** + **enter**. This will move you down into the next cell and return you to command mode. Alternatively, you may press **ctrl** + **enter** to run the cell but this keeps the current cell active.\n",
24+
"\n",
25+
"Alternatively, you may press **esc** at any time to go to command mode.\n",
26+
"\n",
27+
"### More on command mode\n",
28+
"When you are in command mode, your keyboard is transformed such that many of the keys do special tasks. To see these tasks go to the **help** menu and choose keyboard shortcuts. Alternatively, just press **h** while in command mode. Take a look at some of these extra abilities provided with the command mode.\n",
29+
"\n",
30+
"### Raw NBConvert\n",
31+
"This is other type of notebook cell. These cells only have raw text. No enhancements from markdown and no code running. Just plain text.\n",
32+
"\n",
33+
"### More on markdown\n",
34+
"Markdown is a very useful concise syntax for quickly developing web documents without writing HTML. See [this tutorial][2] for more.\n",
35+
"\n",
36+
"[1]: http://jupyter.org/\n",
37+
"[2]: http://commonmark.org/help/tutorial/"
38+
]
39+
},
40+
{
41+
"cell_type": "markdown",
42+
"metadata": {},
43+
"source": [
44+
"## Running Code in the Notebook\n",
45+
"This particular notebook is connected to an IPython kernel which is executing all the Python. Modern web browsers do not run Python code. Any python code that you write is sent to the kernel which the responds with the result. This result is then displayed. Take for instance the next cell which adds two numbers.\n",
46+
"\n",
47+
"Run the cell by pressing **shift** + **enter**"
48+
]
49+
},
50+
{
51+
"cell_type": "code",
52+
"execution_count": 12,
53+
"metadata": {},
54+
"outputs": [],
55+
"source": [
56+
"# press shift enter to execute this cell\n",
57+
"5 + 4"
58+
]
59+
},
60+
{
61+
"cell_type": "markdown",
62+
"metadata": {},
63+
"source": [
64+
"## Best features of the notebook\n",
65+
"### Tab code completion\n",
66+
"Since the notebook is running directly off of IPython it takes advantage of all it has to offer. One of the most common and popular features is tab completion. Place your cursor after the dot below and press tab. A menu should pop up of all the available choices."
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": 13,
72+
"metadata": {
73+
"collapsed": true
74+
},
75+
"outputs": [],
76+
"source": [
77+
"# run this cell\n",
78+
"import pandas as pd"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": null,
84+
"metadata": {
85+
"collapsed": true
86+
},
87+
"outputs": [],
88+
"source": [
89+
"# place your cursor after the dot and press tab\n",
90+
"pd."
91+
]
92+
},
93+
{
94+
"cell_type": "markdown",
95+
"metadata": {},
96+
"source": [
97+
"### Docstring help\n",
98+
"Now we will pop up the docstrings. After we choose an object we can press **shift** + **tab** + **tab** to pop up the docstrings which are immensely helpful in giving us information on how to use the object."
99+
]
100+
},
101+
{
102+
"cell_type": "code",
103+
"execution_count": null,
104+
"metadata": {
105+
"collapsed": true
106+
},
107+
"outputs": [],
108+
"source": [
109+
"# put the cursor in the word DataFrame and press 'shift + tab + tab'\n",
110+
"pd.DataFrame()"
111+
]
112+
},
113+
{
114+
"cell_type": "markdown",
115+
"metadata": {},
116+
"source": [
117+
"# Python Data Science Stack\n",
118+
"\n",
119+
"The next few notebooks will cover the very basics of \n",
120+
"+ NumPy\n",
121+
"+ pandas\n",
122+
"+ Matplotlib\n",
123+
"+ Seaborn\n",
124+
"+ statsmodels\n",
125+
"+ scikit-learn\n",
126+
"+ bokeh\n",
127+
"\n",
128+
"The foundation of scientific computing in Python relies heavily on the library NumPy. NumPy is a low-level library that does extremely fast (for Python standards) array computations. pandas is a higher level library that gives its users much nicer data structures for manipulating and analyzing data. Matplotlib is the most widely-used Python visualization Python library with Seaborn enhancing it. statsmodels has lots of power to do a variety of statistical testing. scikit-learn provides machine learning and bokeh is an up and coming interactive visualization library helpful in deploying apps to the web.\n",
129+
"\n",
130+
"![img][1]\n",
131+
"\n",
132+
"[1]: https://raw.githubusercontent.com/ahirner/smart-factory-audi/master/aux-info/Vanderplas_Python_Stack.png"
133+
]
134+
},
135+
{
136+
"cell_type": "markdown",
137+
"metadata": {},
138+
"source": [
139+
"## References\n",
140+
"* [Jupyter official documentation][1]\n",
141+
"* [Tutorial part of Jupyter documentation][2]\n",
142+
"\n",
143+
"[1]: http://jupyter-notebook.readthedocs.io/en/latest/\n",
144+
"[2]: http://jupyter-notebook.readthedocs.io/en/latest/examples/Notebook/What%20is%20the%20Jupyter%20Notebook.html"
145+
]
146+
}
147+
],
148+
"metadata": {
149+
"kernelspec": {
150+
"display_name": "Python 3",
151+
"language": "python",
152+
"name": "python3"
153+
},
154+
"language_info": {
155+
"codemirror_mode": {
156+
"name": "ipython",
157+
"version": 3
158+
},
159+
"file_extension": ".py",
160+
"mimetype": "text/x-python",
161+
"name": "python",
162+
"nbconvert_exporter": "python",
163+
"pygments_lexer": "ipython3",
164+
"version": "3.6.1"
165+
}
166+
},
167+
"nbformat": 4,
168+
"nbformat_minor": 2
169+
}

0 commit comments

Comments
 (0)