Introduction to D-Tale. Introduction to D-Tale for interactive... | by Albert Sanchez Lafuente | Towards Data Science

D-Tale is a recently created library (end of February 2020) that allows us to visualize a Pandas DataFrame. What D-Tale does is to generate an interactive graphical interface in which we can define what we want the data to look like and do an exploratory analysis of data as we like.
You can see how D-Tale works live at this link. Images in this article have been generated using that example and using our own data that you can download here.
First you have to install it with this command:
pip install --upgrade dtale
We need to have an open Python instance to run it, so we won’t be able to share it easily as we did with Pandas Profiling and we will always need an open Python interpreter to use it. As it is a very new library, it is possible that this will change with later versions and we will be able to export in a single html file executable from any modern web browser.
This is the code to launch the D-Tale interactive application locally:
import dtaleimport pandas as pddf = pd.read_csv(‘data.csv’)d = dtale.show(df)d.open_browser()
Just like that, only 5 lines of code to display a dataset with this tool. Now let’s see what D-Tale can do for us from its graphical interface. Let’s take into account that it is a library that just came out (end of February 2020), probably in a few months there will be new interesting features.
To begin with, what D-Tale does is show us the data in the same way that pandas would. The only difference is the menu in the top left corner that allows us to do many things with the data as we’ll see later. An interesting point is that next to that menu it shows us the number of columns and rows our dataset has.
Clicking on any of the column headings opens a drop-down menu that gives us options to sort the data and display it exactly as we want it. I recommend that you try it out for yourself how each button works.
The most interesting options we can find in this menu are Describe that shows us a statistical analysis of the selected column and Column Analysis that shows us a histogram of the selected column.
With the option Formats we can define how the numbers are displayed (number of decimals, thousands separator, negative numbers in red, ...)
Finally we can filter the data of each column with the last option, we can make that only the values greater or smaller than a number are shown, that only the values contained within a range are shown, or that only the rows that have a certain value for that column are shown.
In the D-Tale main menu you will find all the options available in D-Tale. This is where all the magic of D-Tale is.
Let’s see what each menu item does. Let’s start with Describe. This is the same option that we can access from the column titles to see a statistical analysis of each one of them.
With the Filter option, we can filter the data and only show those rows that meet certain conditions we want. For simple filtering operations, it is easier to use the column filtering described above. For more complex filtering operations, we can use this tool. We have to write the filtering rules according to the code they define on the right side.
With Build Column we can generate new columns, for example we define a new column that is the sum of two others.
With Correlations it will show us how correlated the variables are with each other.
In the Charts option we can generate the graphics we want among the available ones (Line, Bars, ScatterPlot, Circular, Wordcloud, Heatmap, 3D ScatterPlot, and Surface.
We can define which variables we want to be shown in each chart and several more specific parameters for each chart such as the maximum and minimum values we want to be shown.
Finally, one of the fanciest options is the heatmap. It shows us colors in the data table according to the value of each cell.
We finished the article here. We’ll have to wait and see how this library evolves and if it becomes popular among the Data Science community. It certainly has a promising future.