I'm using the Pandas package and it creates a DataFrame object, which is basically a labeled matrix. Often I have columns that have long string fields, or dataframes with many columns, so the simple print command doesn't work well. I've written some text output functions, but they aren't great.
What I'd really love is a simple GUI that lets me interact with a dataframe / matrix / table. Just like you would find in a SQL tool. Basically a window that has a read-only spreadsheet like view into the data. I can expand columns, page up and down through long tables, etc.
I would suspect something like this exists, but I must be Googling with the wrong terms. It would be great if it is pandas specific, but I would guess I could use any matrix-accepting tool. (BTW - I'm on Windows.)
Any pointers?
Or, conversely, if someone knows this space well and knows this probably doesn't exist, any suggestions on if there is a simple GUI framework / widget I could use to roll my own? (But since my needs are limited, I'm reluctant to have to learn a big GUI framework and do a bunch of coding for this one piece.)
Example 1 : One way to display a dataframe in the form of a table is by using the display() function of IPython. display .
You can visualize a pandas dataframe in Jupyter notebooks by using the display(<dataframe-name>) function. The display() function is supported only on PySpark kernels. The Qviz framework supports 1000 rows and 100 columns. For example, you have a pandas dataframe df that reads a .
2019 update: I'm currently working on a successor tabloo.
I wasn't fully satisfied with some other GUIs, so I created my own, which I'm now maintaining on Github. Example:
Apart from the basic table + plot functionality, I wanted to have a specific way to filter data:
_ > 0
to filter positive values only, or more complex expressions like (_ >= date(2016, 1, 1)) & (_ <= date(2016, 1, 31))
e.g. for datetime columns.I use QTableWidget
from PyQt to display a DataFrame
. I create a QTableWidgetObject
and then populate with QTableWidgetItems
created with DataFrame
values. Following is the snippet of code that reads a CSV file ,create a DataFrame
, then display in a GUI:
df = read_csv(filename, index_col = 0,header = 0) self.datatable = QtGui.QTableWidget(parent=self) self.datatable.setColumnCount(len(df.columns)) self.datatable.setRowCount(len(df.index)) for i in range(len(df.index)): for j in range(len(df.columns)): self.datatable.setItem(i,j,QtGui.QTableWidgetItem(str(df.iget_value(i, j))))
Update:
As this answer was quite old, it deserves an update. There are many options available now to view the dataframes in GUI.
If someone still wants to code a simple GUI to view the dataframes within Jupyter, following is the complete , minimal example using Pyqt5 .
%gui qt5 from PyQt5.QtWidgets import QWidget,QScrollArea, QTableWidget, QVBoxLayout,QTableWidgetItem import pandas as pd win = QWidget() scroll = QScrollArea() layout = QVBoxLayout() table = QTableWidget() scroll.setWidget(table) layout.addWidget(table) win.setLayout(layout) df = pd.DataFrame({"a" : [4 ,5, 6],"b" : [7, 8, 9],"c" : [10, 11, 12]},index = [1, 2, 3]) table.setColumnCount(len(df.columns)) table.setRowCount(len(df.index)) for i in range(len(df.index)): for j in range(len(df.columns)): table.setItem(i,j,QTableWidgetItem(str(df.iloc[i, j]))) win.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With