The Research Workspace (RW) includes the ability to create, edit, and upload Jupyter Notebooks. Jupyter Notebook is an open-source application that allows you to embed live code and explanatory text, create plots, and save results and images that encapsulate a data processing workflow. You can think of it like a scientific notebook, wherein the code can be tweaked, changed, optimized, shared and rerun directly on the web.
The RW implementation of Jupyter Notebook supports code from the following languages:
If you’re unfamiliar with Jupyter or IPython notebooks, parts of Jupyter Notebook User Docs are useful, especially the sections describing the following:
If you want to look at some example notebooks in the RW, see the following:
Creating a Jupyter Notebook¶
Create a new Jupyter Notebook file by selecting the new file dropdown from the files view and choosing
Jupyter notebook. This opens a new notebook file (ipynb), which you can rename by clicking on the filename and changing it to something more descriptive.
For more information about how to use file names to help you organize and manage your projects, please see Axiom Data Science’s Best Practices for Data Management.
Changing the Kernel¶
By default, a new notebook will open with a Python kernel of the latest version. The current kernel will be displayed in the top right corner of the window. You can change the kernel to another language by selecting one from under the
Kernel menu. When you open the notebook in the future, it will remember which kernel to use.
Accessing Files from Within Your Notebook¶
Files in the RW Directory¶
One of the main benefits of running a Jupyter notebook in the RW is the ability to analyze data files you’ve uploaded to a project. For both Python and R code, you can reference files in the same project as a Jupyter notebook in the same way you would reference a file in the current working directory of your own computer.
For example, in Python (2 or 3), you could read data from a CSV file in your project like this:
import csv with open('sea_monkey_data.csv', 'r') as csvfile: my_data = csv.reader(csvfile)
In R, a similar example would look like this:
my_data <- read.csv(file="sea_monkey_data.csv")