Introduction to Jupyter Notebook
The Juрyter Nоtebооk is аn орen sоurсe web аррliсаtiоn thаt yоu саn use tо сreаte аnd shаre dосuments thаt соntаin live соde, equаtiоns, visuаlizаtiоns, аnd text. Juрyter Nоtebооk is mаintаined by the рeорle аt Рrоjeсt Juрyter.
Juрyter Nоtebооks аre а sрin-оff рrоjeсt frоm the IРythоn рrоjeсt, whiсh used tо hаve аn IРythоn Nоtebооk рrоjeсt itself. The nаme, Juрyter, соmes frоm the соre suрроrted рrоgrаmming lаnguаges thаt it suрроrts: Juliа, Рythоn, аnd R. Juрyter shiрs with the IРythоn kernel, whiсh аllоws yоu tо write yоur рrоgrаms in Рythоn, but there аre сurrently оver 100 оther kernels thаt yоu саn аlsо use.
The name, Jupyter, comes from the supported programming languages: Julia, Python, and R. Jupyter ships with the IPython kernel, which allows you to write down your programs in Python, but there are currently over 100 other kernels that can used.
To work with jupyter notebook python must be installed, So, first check if python is installed in your work space.
python — version
you can use the following command (it is used to check the python version).
It gives an error if python is not installed. you can install it from python official site.
now add python to the path.
You can use Python’s own packaging system, pip, which is included by default with the Python binary installers (since Python 2.7.9).
you can check if pip is installed or not by typing the following command:
you need to have pip latest version installed.
To upgrade the pip module, type the following command
pip install --upgrade pip
Now you can install all the required modules and their dependencies using this simple pip command.
you can install jupyter notebook using the following command:
pip install jupyter
you can start using jupyter notebook using the following command:
A Jupyter server is now running in your terminal, listening to port 8888. You can visit this server by opening your web browser to http://localhost:8888/ (this usually hap‐ pens automatically when the server starts).You should see your empty workspace directory
Generally people prefer moving to the directory where they want to save the code or files and run the above command.
Now create a new Python notebook by clicking on the New button and selecting the appropriate Python version9 (see Figure 2–3). This does three things: first, it creates a new notebook file called Untitled.ipynb in your workspace; second, it starts a Jupyter Python kernel to run this notebook; and third, it opens this notebook in a new tab.
You should start by renaming this notebook, this can be done by clicking Untitled and typing the new name. (this will automatically rename the file to xxx.ipynb)
A notebook contains a list of cells. Each cell can contain executable code or formatted text. Right now the notebook contains only one empty code cell, labeled “In :”. Try typing print(“Hello world!”) in the cell, and click on the play(run) button or press Shift-Enter. This sends the current cell to this notebook’s Python kernel, which runs it and returns the output. The result is displayed below the cell, and since we reached the end of the notebook, a new cell is automatically created.
The files will be automatically saved most of the time but check before you close it.
You will need a number of Python modules: NumPy, Pandas, Matplotlib, Scikit-Learn and some more modules for working with machine learning. we can download them by using pip command. general syntax for pip: pip install (module name)
pip install pandas