Let’s first load the data and create a smaller sample in order to keep things simple and fast: data = pd.read_csv("diamonds.csv").drop("Unnamed: 0", axis=1)ĭata = data.sample(3000, random_state=420) Still, we will take a short look at the data we will be working with before we move forward. This blog post aims at explaining how to use Bokeh in combination with Juypter Notebooks, so the focus will not be on creating a complete exploratory data analysis (EDA). If you see the success message from below, you should be ready to go! The output_notebook function Short data exploration In combination with output_notebook, it enables us to output our plots inside the Jupyter Notebook!Īll you need to do to output the plots inside the Jupyter Notebook is to call output_notebook before rendering the first plot. Surprisingly, the show function lets us render the actual plot. The figure function allows us to create a basic plot object, where we can define things like height, grids, and tools. The imports from lines 1 and 2 are most important here. In order to get started, let’s import the required libraries and their corresponding aliases: from otting import figure, show If you’re using Anaconda, install it with: conda install numpy pandasĪnd again, if you’re using pip, you need to run the following code: pip install numpy pandas With Anaconda installed, run: conda install bokehįor some basic operations with our data we will also need Pandas and NumPy to be installed. Please make sure to get the latest version of pip/pip3 by running: pip3 install -upgrade pipĪfter that, you’re ready to go ahead and actually install Jupyter Notebook with: pip3 install jupyterĪt this point, we are almost done with the preparation. If you install Anaconda, it automatically installs the right Python version, more than 100 Python packages, and also Jupyter.Īfter downloading and installing Anaconda, you can either open the Anaconda-Navigator and run Jupyter Notebook from there, or just type the following command to your terminal: jupyter notebookĪlternatively, you can also install Jupyter Notebook with pip/pip3. With Python installed, there are actually two ways of installing Juypter Notebook it’s recommended to use Anaconda to install Jupyter Notebook properly.Īnaconda is a Python distribution that provides everything you need to get started quickly with data science-related tasks. In order to install Jupyter Notebook on your machine, you must have Python ≥ 3.3 or Python 2.7 installed. Luckily, Bokeh makes it pretty easy to render plots in Jupyter Notebooks! Installation In the end, a notebook is a series of input cells, which can be executed separately. It supports many languages, including Python and R, and it’s perfectly suited for data analysis and visualization. Jupyter Notebook is an open-source web application which gets hosted on your local machine. And that’s where Bokeh comes in! You cannot only create interactive plots with Bokeh, but also dashboards and data applications. You can’t implement any sort of interaction with the user. Well, with tools like Matplotlib, you are pretty much limited to static visualizations. So the question could arise, why you even should use Bokeh, then? In the introduction, I mentioned that Matplotlib and Seaborn are the most popular data visualization libraries. For the demonstration we will use a diamond data set, which you can get from here.īefore we dive into these tools, I want to quickly explain what Bokeh and Jupyter Notebooks are and when to use them. In addition, after reading this tutorial, you will know how to use Bokeh in combination with a Jupyter Notebook. The most common libraries for data visualization in Python are probably Matplotlib and Seaborn, but in this blog post, we’ll cover another great library called Bokeh. If you’re using Python to analyze data, there are several libraries to choose from. Visualizations can help you and your stakeholders gain a better understanding of the data you’re dealing with. If you’re a data scientist or analyst, visualizing data can be the most interesting part of your job. Python data visualization with Bokeh and Jupyter Notebook I’m enthusiastic about everything concerning web, mobile, and full-stack development. Kevin Tomas Follow My name is Kevin Tomas, and I’m a 26-year-old Masters student and a part-time software developer at Axel Springer National Media & Tech GmbH & Co.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |