r/datascience • u/aschonfe • Feb 20 '20
Tooling For any python & pandas users out there, here's a free tool to visualize your dataframes
19
Feb 20 '20
Can you write here what's the tool name? Thx.
5
u/aschonfe Feb 20 '20
Sorry about that, just posted the information for the github and where to play with the demo. :)
17
u/Africa-Unite Feb 20 '20
Does this work with vscode?
16
u/aschonfe Feb 20 '20
If you open a python console or a debug session within VSCode you should be able to run something like the following:
import dtale; dtale.show([insert pandas object here])This will return a URL which you can view in your browser. Once you close your session or after an hour of inactivity (whichever comes first) D-Tale will clean itself up.
→ More replies (1)17
u/SweetSoursop Feb 20 '20
Is the data stored or analyzed on your side?
I'm asking for data confidentiality reasons, your tool is amazing!
32
u/aschonfe Feb 20 '20
D-Tale is just a simple client for your pandas data structures so under the hood its simply executing pandas functions that you can run in your notebook or console. I'm not doing any statistics reporting on usage so anything you pass it should live and die in the process you running it under.
The one thing I will mention is that the "Export plot to png" function in the charts does send the data in your chart over to a server being run by plotly and returns a downloadable png. So if you're worried I'd stay away from that. I'm planning on removing it anyways. Here's an example of what to look out for:
→ More replies (3)
14
u/gdoshi88 Feb 21 '20
Thank you for this! I’m a teaching assistant for a data analytics bootcamp at a university and I’m going to have my students use this tool
19
u/aschonfe Feb 21 '20
Hearing stuff like that makes it all worthwhile. Make sure they go to the repo and add a ⭐️
😉
→ More replies (7)
8
u/datascientist36 Feb 20 '20
How much data can this handle? Hundreds of thousands of rows and hundreds of columns at once?
→ More replies (1)23
u/aschonfe Feb 20 '20
The base case I was testing when I started building it was 1.5 million rows/200 columns with no issue. The amount of data is more up to how much power your machine has. The browser will only render how many cells can be painted based on dimensions of your window.
I do think performance does degrade a little when you have a really wide dataframe (lots of columns). I hit some lagginess when I loaded 700+ columns
→ More replies (1)
3
u/learn_and_learn Feb 20 '20
Sorry if this is a stupid question. Would this package also be available in R ? Not that I'd pick R over Python however I have a class in which I have to do some heavy data wrangling in R and this package or something similar would be really useful.
3
u/aschonfe Feb 20 '20
Unfortunately no, but i did see there is a package for loading R data into python
http://blog.yhat.com/tutorials/rpy2-combing-the-power-of-r-and-python.html
You can try using that and loading your data in through that and wrapping it in a pandas dataframe and passing it to D-Tale. Honestly, thinking about it I might create a custom CLI loader for it 🤔
2
u/aschonfe Mar 07 '20
I managed to get it working with reticulate
I do plan on trying to get it to allow users to load R datasets into thru the use of rpy2
→ More replies (1)3
u/Defenserocks285 Feb 21 '20
Check out radiant. It's a fantastic tool https://radiant-rstats.github.io/docs/
3
u/nboro94 Feb 21 '20
Is there an easy way to install this with anaconda? My work is very picky about which packages we can download unfortunately and does not play nice with anything that requires admin privileges.
6
2
u/aschonfe Mar 02 '20
Thanks, so glad its helping!
Pivot table is actually in the list of issues/features on github so i’ll be sure to move it priority up :)
The one question about pivot is whether it should spawn a new data instance or overwrite the original data you loaded. I’m fine with spawning a new instance but it may eat up memory depending on how much power your machine has.
2
u/aschonfe Mar 07 '20
Pivoting is now available in the latest release 1.7.14 by way of the new "Reshape" popup
2
u/jovalabs Feb 20 '20
Hmmm can I use this on sublime text? Maybe install it as a package?
9
u/aschonfe Feb 20 '20
Unfortunately I develop on PyCharm, but just like the VSCode user I would assume that there is some way to run a python console from within Sublime and then you'll be able to run something like the following:
import dtale; dtale.show([insert pandas object here])This will return a URL which you can view in your browser. Once you close your session or after an hour of inactivity (whichever comes first) D-Tale will clean itself up.
→ More replies (1)10
u/p_2the_d_2the_upuis Feb 20 '20 edited Feb 20 '20
If you have dtale installed in your python environment and a python build system set up, yeah. Just throw in some code like this:
import pandas as pd import dtale df = <...whatever you do to get your dataframe...> dtale.show(df, open_browser=True, subprocess=False)and then when you run/build that script it'll start up an instance in your browser
→ More replies (2)
2
u/Sebbyy Feb 20 '20
Could this be launched in RStudio using reticulate?
4
u/aschonfe Feb 20 '20
This is only for python unfortunately but if you had the time to install python you could try exporting your R data to CSV or JSON and use the command line options to load it into D-Tale: CLI options
Sorry I still need to add the documentation on how to use the JSON options
2
u/Sebbyy Feb 20 '20
Well reticulate lets you run python through RStudio, I’m just wondering if it would still work. May test later
→ More replies (6)
2
u/bigno53 Feb 21 '20
This is awesome!!! Does it perform well with large dataframes? Say around 2 million records?
6
u/aschonfe Feb 21 '20
The base case I was testing when I started building it was 1.5 million rows/200 columns with no issue. The amount of data is more up to how much power your machine has. The browser will only render how many cells can be painted based on dimensions of your window.
I do think performance does degrade a little when you have a really wide dataframe (lots of columns). I hit some lagginess when I loaded 700+ columns
2
u/CanadianGuy3 Feb 21 '20
First of all, nice work and thank you & you’re team for sharing. Secondly, would this work for displaying a dataframe that is being added to? I noticed “Security X” in the video, I’m curious if I could leave this window open and watch as say trade results come in to analyze each individually, as the backtest runs?
2
u/aschonfe Feb 21 '20
If you’re working in a jupyter notebook or python console you can save your D-Tale in a variable:
d = dtale.show(df)
Then if you want to change your data later on you do:
d.data = new_df
or if you’re stacking timeseries data:
d.data = pd.concat([d.data, new_df])
And then just refresh your browser or if you’re in an ipython cell go to the menu in the upper lefthand corner and click “refresh”
2
u/fistQL Feb 21 '20
This looks great, whats the size of dataframes it can work with without hanging?
1
u/aschonfe Feb 21 '20
The base case I was testing when I started building it was 1.5 million rows/200 columns with no issue. The amount of data is more up to how much power your machine has. The browser will only render how many cells can be painted based on dimensions of your window.
I do think performance does degrade a little when you have a really wide dataframe (lots of columns). I hit some lagginess when I loaded 700+ columns
2
u/deathuntor Feb 21 '20
Cool stuff. Just wondering, can you add colours to your bar/pie plots?
I've been digging through your rather sparse documentation and it seems like it's not an available option right now?
1
u/aschonfe Feb 21 '20
Not at the moment. Plotly/dash has a pregenerated color scheme for each series in a chart. Its certainly something that could be added just need to figure out the right way to do it.
I’ve added color builders in the past and they usually require so many clicks people dont use them
→ More replies (3)
2
u/Apokaliptic Feb 21 '20
Amazing! I just wonder if the UI and the browser functionality will work in a remote jupyter server (like aws Sagemaker) because I read it'll use the system default browser, or am I misunderstanding that part? Keep the good work!
4
u/aschonfe Feb 21 '20
So I've done some work using this in jupyterhub and it does get tricky if you're running it within docker. You'll have to add
--network hostwhen runing the container so the ports will be opened to the outside world.I've also had trouble if you're running jupyterhub over a proxy. You'll have to add someway to allow for certain ports to be open for D-Tale processes. I did a big re-write a while back so that there is a little bit of predictability to how the ports are chosen for D-Tale. Now it starts at 40000 and then keep incrementing until it finds an open one. So you could update your proxy to allow for port 4000 to be open for D-Tale processes and then just keep killing the previous D-Tale instance if you open a new notebook and create a new instance. If you just keep calling
dtale.showwithin one notebook it will be fine becuase it only opens one instance and adds more data globally available to it.The urls to your D-Tale instances should be sharable. To access what the URL is you can do one of two things:
if you've stored your D-Tale instance in a variable you can do something like this:
d = [dtale.show](https://dtale.show)(df) print(d._url) . # sent this link to others to view it2) in the ipython cell that D-Tale is running there should be an option in the menu for "Open Popup". This will open D-Tale in a new window which should have the url listed in the top and you can send that to others.
Hope this helps!
1
u/aschonfe Mar 07 '20
Just following up on this. I got it working with hosted notebooks like kaggle & google colab
I also have some documentation on getting it running with kubernetes/jupyterhub
2
2
u/arnott Feb 21 '20
Impressive.
Am getting this on chrome, what setting do I need to change ?
This site can’t be reached pc-win10 refused to connect.
2
u/aschonfe Feb 21 '20
So this article has a bunch of suggestions on how to fix it: https://windowsreport.com/err-connection-refused-windows-10/
I think a lot of the problem is the windows firewall so turning it off might work (although that might be overkill). There should be a way to allow python processes through. You don't want to allow a specific port through (although if you go that route 40000 is the best choice) because if you run multiple notebooks each with a different D-Tale instance they will be on different ports.
Unfortunately I mainly develop on linux so I don't hit these issues. But i'm going to take some time next week to setup an environment on windows so I can be a little more helpful with these issues. Sorry :(
Here's another article on how to allow python processes through the firewall: https://www.howtogeek.com/howto/uncategorized/how-to-create-exceptions-in-windows-vista-firewall/
→ More replies (1)
2
u/CainV Mar 02 '20
u/aschonfe , This is really amazing! I've been always thinking about some tool with Excel interface and power of Python, on the one hand Excel is easy to use and allows faster data manipulations but on larger datasets it would be freezing, so this tool should definitely come in handy!
How long until we see features like Excel's pivot table?
2
u/aschonfe Mar 07 '20
Pivoting is now available in 1.7.14 by way of the “Reshape” popup
→ More replies (1)
2
u/Fraserac67 Mar 07 '20
Gotta try this...will it work with Anaconda Jupyter on Linux? D-Tale graphic look great! 👍🤟
2
u/aschonfe Mar 07 '20
I’ve never tried it but D-tale is available on conda-forge https://github.com/conda-forge/dtale-feedstock
→ More replies (1)2
u/aschonfe Mar 07 '20
Also, should have a new version released in another hour if you want to wait a little bit to install it 👀
1
u/aschonfe Mar 07 '20
New version is out there on pip, should be on conda soon too. Just includes a fix for the Reshape popup when forwarding to a new data point. Probably wouldnt have noticed the issue anyways 🤣
2
u/ooooh_burn May 30 '20
Amazing tool, but one concern, what about data privacy? does data get shared online? can we setup a local server?
1
u/aschonfe May 30 '20
The demo is public, but for personal use it should be private unless you’re hosting your local notebooks for everyone to see.
I think even kaggle and google colab makes their notebooks only available to the users running them.
I believe the user would really have to do some work on their end to make their D-Tale instances public.
117
u/Exyen Feb 20 '20
This is low key freaking AMAZING as someone coming from an excel background
18
u/PikaBlue Feb 20 '20
Definitely a tool that smooths the transition! I say as someone transitioning painfully now 😅
→ More replies (2)
19
u/cocainesmoothies Feb 20 '20 edited Feb 20 '20
Oh wow the dynamic transitions make this so cool.
EDIT** This is like a python BI Tool
15
u/AndMax1 Feb 20 '20
This is my first comment on Reddit (I believe) and whooaa. This tool looks really good! Kudos. I will definitely request it to try it.
Keep up the work!
23
u/ADONIS_VON_MEGADONG Feb 20 '20 edited Feb 20 '20
Looks cool, definitely going to check this out.
Edit: Okay yeah this is incredible, well done!
9
5
1
u/knut_2 Feb 20 '20
who's Andrew Schonfeld ?
3
u/aschonfe Feb 20 '20
I think hes kind of like a Spartacus-type character where hes in the hearts of each and every one of us...😏
→ More replies (1)2
u/p_2the_d_2the_upuis Feb 21 '20 edited Feb 22 '20
A man at Man, but not just any old man at Man — one of the Alpha men at Man.
1
u/Zenith_N Feb 21 '20
Thank you Does it work in Anaconda Spyder ? Thank you
4
1
u/Specialist-Truth Feb 21 '20
Any else have luck trying to use dtale with google colab?
2
u/aschonfe Feb 22 '20
I did some more digging and it looks like google colab does support using flask: https://medium.com/@kshitijvijay271199/flask-on-google-colab-f6525986797b
I'll see if I can add an optional dependency on run_with_ngrok so you can do this! I'll keep you posted
1
u/aschonfe Feb 21 '20
So I was able to get D-Tale installed by running `!pip install dtale` but I think that google collab must be running under some sort of proxy because when D-Tale presents the user with the URL associated with the data it has loaded you can't view it.
You can try talking to the admins at google collab and see if they would be willing to allow access to processes like this. Maybe just opening access to port 40000 similar to what we had to do with jupyterhub. I've been meaning to ask kaggle (a similar data science site to google collab) the same thing
1
1
1
u/aschonfe Feb 24 '20
this is now available in version 1.7.9, please see this post: https://www.reddit.com/r/datascience/comments/f8uphl/dtale_pandas_dataframe_visualizer_now_available/
1
u/Zenith_N Feb 21 '20
I keep getting errors like below when trying to build a chart.
Traceback (most recent call last): File "C:\Users\myname\Anaconda3\lib\site-packages\dtale\dash_application\charts.py", line 723, in build_figure_data data = run_query(DATA[data_id], query) KeyError: '2'
2
u/aschonfe Feb 21 '20
So it looks like your instance for data_id '2' is gone. Did you previously kill a running instance?
If you jump back to the data grid there is a button in the menu in the upper lefthand corner which will show you running instances.
It should be noted that D-Tale will try to clean itself up after an hour of inactivity so that might be how your data was removed. If you would like to turn this behavior off then you can open D-Tale using this command:
`dtale.show(df, reaper_on=False)`That will stop the auto-cleanup. Hope this helps :)
1
u/Zenith_N Feb 21 '20 edited Feb 21 '20
Thank you very much,
Still not working :(
How can I kill these instances at once to start fresh ?
1
u/aschonfe Feb 21 '20
So you can open up one of your instances in a browser, click the menu in the upper lefthand corner and then click "Shutdown"
If it starts throwing issues even after you shutdown the app you can try restarting the kernel of your notebook.
→ More replies (7)2
u/aschonfe Feb 23 '20
I just released version 1.7.8 which should solve this issue. My apologies for the headaches. It's currently on pip, not conda yet but shortly.
→ More replies (1)
1
u/mattstats Feb 21 '20
Do I need to be in a browser or can I use pycharm to open that window? (At lunch but I wanna try this soon)
2
u/aschonfe Feb 21 '20
You do need a browser to view it, but I believe that PyCharm can run a browser inside it.
Configuring browser in PyCharm
You may have to install a browser wherever you're running this though. That shouldn't be an issue. I have both modzilla & chrome installed on my linux server.
→ More replies (1)
1
u/anselminie Feb 21 '20
Hi! I installed it using pip, but I can’t import it neither in spyder nor pandas. Any way to solve that?
1
u/aschonfe Feb 21 '20
Are you trying to run it in a jupyter notebook or from a console? Also, can you send over the error you're receiving?
1
u/anselminie Feb 21 '20
Im getting “ModuleNotFoundError: No module named ‘dtale’”. In jupyter and also pasting the same code in a scritp in spyder
1
u/aschonfe Feb 21 '20
So after you installed D-Tale did you restart the kernel of your notebook? Also, are you sure that your notebook is using the environment that you installed dtale too?
The only way you would receive that error is if dtale was not installed to your virtual environment. You can also make sure dtale is installed correctly by going to the command line and running the command
pip freeze | grep dtalewhich should show that version 1.7.5 is installed2
u/anselminie Feb 21 '20
Thanks! It was the environment. I installed it through conda and works fine. It’s pretty useful for data exploratory analysis. Saving time to plot the variables and so on
2
1
u/DBlackBird Feb 21 '20
I would like to test it, but I receive this error every time: SSL_ERROR_RX_RECORD_TOO_LONG
I´ve tried making Python public under "Allowed Apps" on windows, but still...
1
u/aschonfe Feb 21 '20
It also appears that the SSL error you're seeing is associated with Firefox any chance you could try opening the link in chrome or, takes deep breath, IE?
If you need a quick way to generate a link you could try opening a python console (running
pythonfrom the command line) and running the following code snippet:import pandas as pd import dtale dtale.show(pd.DataFrame([1,2,3]))This should return a url which you be able to paste into your browser and see a grid with one column and 3 rows.
1
u/DBlackBird Feb 21 '20
I´ve tried Chrome too. I get this error message: ia2298w10 sent an invalid response.
I´ve managed to get it up when I ran it from the python console as you told me.
Any idea of what is wrong?
1
u/aschonfe Feb 21 '20
So I found this article (https://www.thesslstore.com/blog/fix-err-ssl-protocol-error/). Once again, it seems like another instance where windows is going overkill on the security.
Based on the comments it looks like possibly doing this might work:
• Open Run by pressing Windows logo key and R
• Type C:\Windows\System32\drivers\etc in the Open: search space and press
• Right-click on the hosts file and press Delete. Restart your PC.
I also saw in another article that the Flask installation might be corrupted. In which case you can try going to your virtual environemtn and doing:
pip unsinstall Flask pip install -U Flask
3
3
3
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
Feb 21 '20
This is really good dude. Thankyou and have a star!
One suggestion: Register at https://www.buymeacoffee.com/ so I (and hopefully others) can buy you a coffee!
2
2
u/Here_be_sloths Feb 21 '20
This is absolutely amazing! Immediately going to share this with my team at work
2
u/corcoro Feb 21 '20
Seems to be a great tool for making some sense of new data. Will definitely give it a try
2
u/joeycloud Feb 21 '20
Fantastic work mate! If you were a GitHub sponsor I'd support your work on this project :)
2
2
2
2
2
2
2
u/Ya1233 Feb 25 '20
I legitimately love you. You have risen to 2nd in my power rankings after my mother.
2
2
2
2
u/Fraserac67 Mar 07 '20
I found the info you can ‘pip install dtale’ from pypi.org then import dtale.
1
u/UncrewedImp Feb 20 '20
!remindme 1 year
9
1
u/RemindMeBot Feb 20 '20 edited Feb 21 '20
I will be messaging you in 1 year on 2021-02-20 19:55:16 UTC to remind you of this link
3 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.
Parent commenter can delete this message to hide from others.
Info Custom Your Reminders Feedback
0
Feb 22 '20
[deleted]
1
u/aschonfe Feb 22 '20
Are you talking about an error? Sorry, just want to make sure it gets addressed if thats the case :)
0
Feb 23 '20
[deleted]
1
u/aschonfe Feb 23 '20
Got it. I’ve already had a request for code snippets to be made available (at least when generating charts) and i’ll be addressing it soon.
Certainly a valid gripe
0
Feb 23 '20
[deleted]
1
u/aschonfe Feb 23 '20
Totally understandable and funny enough I’ve actually built similar functionality (code snipptets) in previous apps
1
2
Feb 21 '20
[removed] — view removed comment
1
u/aschonfe Feb 21 '20
Currently it is being built on python 27-3 & 36-1. If you are running a python version higher than 3.6 you might get issues.
I am planning on tackling 3.8 soon
1
Feb 21 '20
[removed] — view removed comment
2
u/aschonfe Feb 21 '20
Ahhh, yea this was what I was afraid of. Looks like some of the packages (in this case Dash) doesn't support the latest version of their software in the latest version of Python :shrug:
1
1
Feb 21 '20
[removed] — view removed comment
2
u/aschonfe Feb 21 '20
I think you need to downgrade Python to 3.6, I havent built support for python 3.7 or 3.8 yet.
I’ll try tackling that soon
1
Feb 22 '20
[removed] — view removed comment
2
u/aschonfe Feb 22 '20
Looks like
eager_loadingwasn't available until dash version 1.5.0. So if you're running something earlier than that you'll get issues. I can pin it to >=1.5.0 to fix this going forward1
u/aschonfe Feb 22 '20
Hmm, i wonder if the right version of plotly/dash is being installed if you run the following from your command line:
conda list | grep dash
It should show you what version you have. I built it using 1.9.0, i can try adding a check for that in the code
148
u/aschonfe Feb 20 '20
Sorry for posting this information late.
The name of this tool is D-Tale ("Data Tale" or "The Tale of your Data"). Please submit any requests or issues on our github
Interactive demo available here
Thanks and hope you enjoy!