<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Jupyter Notebooks
Step1:  In order to get our plots to show up in the notebook (rather than as pop-ups in new windows), we need to use a little magic (that's what it's called!) command
Step2:  Then, let's load up the iris dataset &mdash; this is a classic dataset that is used in a variety of fields. We're going to read in a CSV file (hosted on-line)
Step3:  Moving to R
We can also go back and forth between python and R. 
Why would you want this, you ask? Well, R is the program for statistics, but I would argue python modules are more diverse and better at heavy computational analyses. What if you want to do both, shuffling your data back and forth between python and R?
First, let's see how we can run commands (that we would normally run in the terminal!) from a notebook
Step4:  Then, let's load the extension
Step5:  Then, let's make a little variable to send over to R. We're just going to make some random data and call it x and y.
Step6:  Now, let's do some R! We do this with the magic command %%R, which tells our Jupyter Notebook that everything in the cell should be interpreted as R code. 
We also use the argument -i for_R to say that we want our variable for_R to be sent to the R environment.
We'll just do a basic plot
Step7:  You can see that the R plots are also displayed in-line to create a seamless flow between code, exposition, and graphics!
Other languages!
Jupyter Notebooks aren't just confined to R and python, though
Step8:  HTML
<ASSISTANT_TASK:>
Python Code:
import numpy as np      # this loads a library for manipulating data
import pandas as pd     # this loads a library for handling datasets
import seaborn as sns   # this loads a library for making plots
sns.set(style='white')  # this says we want an extra-pretty plotting style
Explanation: Jupyter Notebooks: A quick tutorial
Markdown
All the text in this Jupyter Notebook is written in Markdown; we briefly talked about Markdown during the git tutorial, but it's a plain-text language that allows for fancy HTML rendering.
It allows you to bold text, to italicize it, and to make lists:
This
is
a 
list
all using plain text (i.e., not Microsoft Word or Google Docs). If you've ever used RMarkdown, then you might be familiar with some of the basics. Jupyter Notebooks will happily render any and all Markdown text for you, which makes detailing the work you do in the Notebook easy and intuitive.
You can select that you want a Markdown cell by selecting the dropdown menu located in the top toolbar (it defaults to 'Code') and choosing 'Markdown.'
A great cheatsheet with the various Markdown options and syntax is available at https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet &mdash; you can use http://bit.ly/1dQOfRK if you'd prefer a bit.ly link.
Getting started (with Python)
We're going to play around with Python a little bit at first. The thing to remember here is that you don't need to know what these commands are doing. The goal here is to demonstrate how Jupyter Notebooks work -- the general structure and function of them -- to understand how they can be useful for you:
We'll start off with some default import for our Python code. This is just to get us started!
End of explanation
%matplotlib inline
Explanation: In order to get our plots to show up in the notebook (rather than as pop-ups in new windows), we need to use a little magic (that's what it's called!) command:
End of explanation
iris = pd.read_csv('http://bit.ly/2oKcw7S')  # read the CSV file in and assign it to a variable
iris.head()                                  # invoke the "head" command to look at the first few entries
sns.jointplot(x='sepal_length', y='sepal_width', data=iris);  # make a plot comparing sepal_length and sepal_width
Explanation: Then, let's load up the iris dataset &mdash; this is a classic dataset that is used in a variety of fields. We're going to read in a CSV file (hosted on-line):
End of explanation
!conda install -y rpy2
Explanation: Moving to R
We can also go back and forth between python and R. 
Why would you want this, you ask? Well, R is the program for statistics, but I would argue python modules are more diverse and better at heavy computational analyses. What if you want to do both, shuffling your data back and forth between python and R?
First, let's see how we can run commands (that we would normally run in the terminal!) from a notebook:
End of explanation
%load_ext rpy2.ipython
Explanation: Then, let's load the extension:
End of explanation
for_R = pd.DataFrame(np.random.rand(100,2),  # make a random 100 x 2 array
                     columns=['x','y'])      # make the column names 'x' and 'y'
for_R.head()                                 # invoke the "head" command to look at the first few entries
Explanation: Then, let's make a little variable to send over to R. We're just going to make some random data and call it x and y.
End of explanation
%%R -i for_R -o my_output
my_output <- c(1,2,3)
require(ggplot2)         # load the ggplot2 library
qplot(x, y, data=for_R)  # make a scatter plot
my_output
%R head(for_R)
Explanation: Now, let's do some R! We do this with the magic command %%R, which tells our Jupyter Notebook that everything in the cell should be interpreted as R code. 
We also use the argument -i for_R to say that we want our variable for_R to be sent to the R environment.
We'll just do a basic plot:
End of explanation
%%bash
echo "Jupyter notebooks can render bash commands!"
for number in {1..5}; do 
    echo $number
done
Explanation: You can see that the R plots are also displayed in-line to create a seamless flow between code, exposition, and graphics!
Other languages!
Jupyter Notebooks aren't just confined to R and python, though:
bash
End of explanation
%%HTML
<h4>And they can render HTML, too!</h4>
<br>
Which lets us insert pictures:
<img src="http://i.onionstatic.com/avclub/4287/59/16x9/960.jpg" height="400", width="400">
Explanation: HTML
End of explanation
<END_TASK>