This quick tutorial shows how to view all active D-Tale instances in your Python session. For a complete introduction to D-Tale’s interactive capabilities, see our D-Tale: Visual Analytics for Pandas DataFrames guide.
The Problem
When working with multiple datasets, you might launch several D-Tale sessions throughout your analysis. Each session opens in a new browser tab with its own URL and port number. After exploring different DataFrames, you lose track of which D-Tale windows correspond to which datasets. Without a way to see all active sessions, you can’t easily switch between them or clean up sessions you no longer need.
The Solution
An “instance” in D-Tale refers to a single active session running on your machine. Each time you call dtale.show(), you create a new instance with its own web interface, unique ID, and port number. Think of each instance as a separate D-Tale window viewing a different DataFrame. The dtale.instances() function displays all currently running instances in your Python session.
import dtale
import seaborn as sns
df_tips = sns.load_dataset('tips')
d1 = dtale.show(df_tips)
# See all active instances
print(dtale.instances())
Output:
To gain access to an instance object simply pass the value from 'ID' to dtale.get_instance(ID) ID Name URL 1 http://The-XXXXXXX.local:40000/dtale/main/1
The output lists each instance with three key pieces of information: an ID number that uniquely identifies the instance, a name field (often empty unless you specify one), and the full URL where you can access that instance in your browser. The ID increments with each new instance you create during your Python session.
This function helps you track multiple datasets when comparing different subsets, analyzing related tables, or exploring various transformations. If you accidentally close a browser tab, the instance keeps running. Use dtale.instances() to find the URL and reopen it. Each instance stays active until you explicitly close it with the kill method or restart your Python kernel.
A Few Tips
You can access any running instance directly using its ID number. Call dtale.get_instance(1) to retrieve the first instance, then use its methods or access its data attribute. This works well when you need to reference an instance created earlier in your session but no longer have the variable assignment.
D-Tale instances consume memory proportional to their DataFrame size. If you create many instances during exploratory work, check the active list periodically and close sessions you’re finished with to free up resources.
Conclusion
The instances function gives you visibility into all active D-Tale sessions. Track multiple datasets easily and manage your exploration workflow across different DataFrames.
