Ryven icon indicating copy to clipboard operation
Ryven copied to clipboard

Pandas support

Open kevinlinxc opened this issue 2 years ago • 4 comments

I'm looking for a widget to display a Pandas Dataframe, or at least the preview of one. Any ideas for how to do this? In general, support for Pandas would be really helpful as it is one of the Python behemoths of data processing and would work really well with Ryven

kevinlinxc avatar Dec 06 '22 18:12 kevinlinxc

This is only part of what you want, but: The pandas functions themselves can be accessed as nodes by auto-generating nodes for them for pandas 1.1.5 (1.5.1 does not work for some reason). You can do that with:

  1. pip3 install pandas==1.1.5
  2. python3 ~/.local/lib/python3.9/site-packages/ryven/example_nodes/auto_generated/autogen.py 'pandas' '#00aadd' 'pandas'
  3. Then do File->"Import Nodes" and select the generated file

As for a "widget to display a Pandas Dataframe" you'd need to write that part. (there's probably something helpful in the documentation about how to write nodes).

ddevz avatar Dec 07 '22 22:12 ddevz

@ddevz thanks for the reply. I made some custom pandas nodes which are a bit more dynamic than the autogenerated ones would be, but I'm glad to hear autogeneration is an option at all.

There isn't much in the documentation about writing custom widgets, at least to the level that I want to. I have a general idea, I think I'll need to use PyQT widgets in widgets.py, but I'm not sure how to set the height of the widget and the node dynamically since dataframes tend to be long and wide.

kevinlinxc avatar Dec 07 '22 23:12 kevinlinxc

The guide describes how to link a widget in your node, which is simply a QWidget. For actually building your custom widgets please refer to the Qt For Python documentation.

edit: there probably exist good examples online for Qt widgets displaying pandas dataframes

leon-thomm avatar Dec 08 '22 03:12 leon-thomm

I decided to make a simple node that does print(self.inputs(0)). I felt like the redirected stdout window takes up too much valuable room but I discovered verbose mode which prints to the original console where I ran Ryven which is nice.

kevinlinxc avatar Dec 08 '22 18:12 kevinlinxc