Code Monkey home page Code Monkey logo

pandastable's Introduction

pandastable

PyPI version shields.io License: GPL v3 Build: status

Introduction

The pandastable library provides a table widget for Tkinter with plotting and data manipulation functionality. It uses the pandas DataFrame class to store table data. Pandas is an open source Python library providing high-performance data structures and data analysis tools. Tkinter is the standard GUI toolkit for python. It is intended for the following uses:

  • for python/tkinter GUI developers who want to include a table in their application that can store and process large amounts of data
  • for non-programmers who are not familiar with Python or the pandas API and want to use the included DataExplore application to manipulate/view their data
  • it may also be useful for data analysts and programmers who want to get an initial interactive look at their tabular data without coding

The DataExplore application using these classes is included in the distribution and is a self-contained application for educational and research use. Currently this focuses on providing a spreadsheet like interface for table manipulation withconfigurable 2D/3D plotting. A windows standalone installer is available that does not require Python installation.

Documentation is at http://pandastable.readthedocs.io/

Note: dataexplore has now been re-implemented in the Qt toolkit in a new app called Tablexplore. If you're only interested in the application and not the Tkinter widget, the new app is recommended.

Note 2: pandas 1.0 no longer supports msgpack format so the project files now use pickle. You will not be able to open your old project files in pandastable versions >0.12.1.

Installation

Requires python>=3.6 or 2.7 and numpy, matplotlib and pandas. These requirements should be satisfied automatically when using: (You may need to use pip3 to specify python version 3).

pip install pandastable

Install latest from github:

pip install -e git+https://github.com/dmnfarrell/pandastable.git#egg=pandastable

You can also install the dataexplore snap package on any linux distribution that supports snaps. This installs everything you need as one app:

sudo snap install dataexplore

see the docs for more details on installing.

Current features

  • add, remove rows and columns
  • spreadsheet-like drag, shift-click, ctrl-click selection
  • edit individual cells
  • sort by column, rename columns
  • reorder columns dynamically by mouse drags
  • set some basic formatting such as font, text size and column width
  • save the DataFrame to supported pandas formats
  • import/export of supported text files
  • rendering of very large tables is only memory limited
  • interactive plots with matplotlib, mostly using the pandas plot functions
  • basic table manipulations like aggregate and pivot
  • filter table using built in dataframe functionality
  • graphical way to perform split-apply-combine operations

FAQ

What version of Python?

Python versions >=2.7 and >=3.6 are compatible. Python 3 is recommended if possible. For a similar table widget that works without pandas dataframes and has minimal dependencies see the previous incarnation, tkintertable.

Why use Tkinter?

Tkinter is still the standard GUI toolkit for python though it is sometimes disliked for its outdated appearance (especially on linux) and somewhat limited widget set. However largely because this library is based on an older one called tkintertable for drawing the table, I have stuck with tkinter rather than start from scratch using another toolkit.

Is this just a half-baked spreadsheet?

Hopefully not. Some of the basic functions are naturally present since it's a table. But there is no point in trying to mimic a proper spreadsheet app. pandas can do lots of stuff that would be nice for a non-programmer to utilize and that might not be available in a spreadsheet application.

Are there other better tools for dataframe visualization?

This depends as always on what is required. The ipython notebook is good for interactive use. bokeh is an advanced interactive plotting tool using modern generation web technologies for in browser rendering. This can handle dataframes. The goal of this project is to use DataFrames as the back end for a table widget that can be used in a desktop appplication.

The DataExplore application

Installing the package creates a command dataexplore in your path. Just run this to open the program. This is a standalone application for data manipulation and plotting meant for education and basic data analysis. See the home page for this application at http://dmnfarrell.github.io/pandastable/

For programmers

Links

Citation

If you use this software in your work please cite the following article:

Farrell, D 2016 DataExplore: An Application for General Data Analysis in Research and Education. Journal of Open Research Software, 4: e9, DOI: http://dx.doi.org/10.5334/jors.94

pandastable's People

Contributors

816-8055 avatar aivarannamaa avatar b-basa avatar bigoulours avatar bst-gbr avatar dmnfarrell avatar gdrosos avatar inkenbrandt avatar ismael-vc avatar machinelearning2014 avatar occoder avatar oneirag avatar rpgoldman avatar sohamsjain avatar wlipski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pandastable's Issues

Immediate crash on windows/anaconda

Using Python 3.5.1 (anaconda 2.5.0) on win7 x86_64.
pip install pandastable executes cleanly.

from the anaconda command prompt:

[Anaconda3] C:\Projects> dataexplore
results in:
capture

and no command-line output for debug is available.

[OS X] Could not set the fontsize for facefile

I am on:

ProductName:    Mac OS X
ProductVersion: 10.10.5
BuildVersion:   14F27

Python 3.3.5 :: Anaconda 2.3.0 (x86_64)

When I execute dataexplore, I get the following error message:

//anaconda/envs/py3k/lib/python3.3/site-packages/matplotlib/__init__.py:1318: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)
2015-09-28 22:44:28.329 python3[40540:2441260] setCanCycle: is deprecated.  Please use setCollectionBehavior instead
2015-09-28 22:44:28.341 python3[40540:2441260] setCanCycle: is deprecated.  Please use setCollectionBehavior instead
Traceback (most recent call last):
  File "//anaconda/envs/py3k/bin/dataexplore", line 9, in <module>
    load_entry_point('pandastable==0.5.0', 'gui_scripts', 'dataexplore')()
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/app.py", line 540, in main
    app = ViewerApp()
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/app.py", line 88, in __init__
    self.newProject()
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/app.py", line 235, in newProject
    self.addSheet('sheet1')
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/app.py", line 348, in addSheet
    pf = table.showPlotViewer(f2)
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/core.py", line 1878, in showPlotViewer
    self.pf = PlotViewer(table=self, parent=parent)
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/plotting.py", line 56, in __init__
    self.setupGUI()
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/plotting.py", line 99, in setupGUI
    self.mplopts = MPLBaseOptions(parent=self)
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/plotting.py", line 608, in __init__
    fonts = getFonts()
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/plotting.py", line 811, in getFonts
    fonts = [matplotlib.font_manager.FontProperties(fname=fname).get_name() for fname in l]
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/pandastable/plotting.py", line 811, in <listcomp>
    fonts = [matplotlib.font_manager.FontProperties(fname=fname).get_name() for fname in l]
  File "//anaconda/envs/py3k/lib/python3.3/site-packages/matplotlib/font_manager.py", line 736, in get_name
    return ft2font.FT2Font(findfont(self)).family_name
RuntimeError: Could not set the fontsize for facefile  /System/Library/Fonts/Apple Color Emoji.ttf

What can be a possible issue? I already deleted my .matplotlib folder as suggested on stackoverflow.com.

IPython console errors with attribute error

Just installed 0.7.2 with pip install into Anaconda Python 3.5.2, and upon a clean launch and selecting Plugins -> IPython console presented with an error dialog:

'InteractiveShellEmbed' object has no attribute 'prompt_manager'

The only messages I see in the console are:

2017-01-24 14:09:12.315 python[82437:47518047] setCanCycle: is deprecated.  Please use setCollectionBehavior instead

DataExplore crashes when called from python

Using python 3.6 and trying to create an instance of DataExplore, the application opens and a sheet with the dataframe appears, however the application does not respond and has to be killed.

Apply the sort not only the column but also on the graph

When I apply a sort on a column, I would like to see the graph changes also.

In my test, it keeps the original order. In my use case, I would prefer to see the sort also in the graph to get a better overview of the data distribution for my column.

Enhancement for Table.copy

Currently if only one cell is selected in the table and the selection is copied to the clipboard, the whole column including index and column label is actually written to the clipboard.
In my opinion it would be more intuitive if only the selected value is copied.
Additionally when one column or a part of a column is selected, only the selected values should be copied.
When whole rows or more than one column is selected, the data should be copied as it is now.

What do you think?

Bug in Table.copy for colums with length > 50

In fix for #49 is a bug which causes that strings longer than pandas.options.display.max_colwidth (defaults to 50) are truncated when copying the value of a single cell to clipboard.

Example data:

pandas.DataFrame(['a very long string inside a pandas.DataFrame instance'])

'a very long string inside a pandas.DataFrame i...' is copied to the clipboard.

immediate crash on OSX El Cap

(unrelated to #37 as far as I know)

Running python 3.5.1 on OSX El Cap (10.11.3). I have multiple versions of python installed, all using homebrew (so which python3 returns /usr/local/bin/python3 and which python returns /usr/local/bin/python).

pip install pandastable executes cleanly.

at a command prompt, this crash occurs. I examined the contents of /usr/local/bin/dataexplore and modified the first line to point at the right python3 location, to no change.

gvoysey@host % dataexplore
/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py:1350: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)
2016-03-23 09:25:46.856 Python[40618:8434553] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fd83376bd90
2016-03-23 09:25:46.858 Python[40618:8434553] An uncaught exception was raised
2016-03-23 09:25:46.858 Python[40618:8434553] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7fd83376bd90
2016-03-23 09:25:46.858 Python[40618:8434553] (
    0   CoreFoundation                      0x00007fff93588ae2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff8960173c objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff9358bb9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff934c4601 ___forwarding___ + 1009
    4   CoreFoundation                      0x00007fff934c4188 _CF_forwarding_prep_0 + 120
    5   Tk                                  0x00000001107a1958 TkpInit + 476
    6   Tk                                  0x000000011071ca7e Tk_Init + 1799
    7   _tkinter.cpython-35m-darwin.so      0x00000001105fbd6a Tcl_AppInit + 82
    8   _tkinter.cpython-35m-darwin.so      0x00000001105f731e _tkinter_create + 1112
    9   Python                              0x000000010f7c4ae9 PyCFunction_Call + 273
    10  Python                              0x000000010f8282eb PyEval_EvalFrameEx + 22399
    11  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    12  Python                              0x000000010f822b57 PyEval_EvalCodeEx + 78
    13  Python                              0x000000010f7adcc3 function_call + 377
    14  Python                              0x000000010f78c1de PyObject_Call + 97
    15  Python                              0x000000010f79e8f0 method_call + 140
    16  Python                              0x000000010f78c1de PyObject_Call + 97
    17  Python                              0x000000010f7d6a7e slot_tp_init + 57
    18  Python                              0x000000010f7d3e03 type_call + 171
    19  Python                              0x000000010f78c1de PyObject_Call + 97
    20  Python                              0x000000010f828047 PyEval_EvalFrameEx + 21723
    21  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    22  Python                              0x000000010f82c0af fast_function + 341
    23  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    24  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    25  Python                              0x000000010f82c0af fast_function + 341
    26  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    27  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    28  Python                              0x000000010f82c0af fast_function + 341
    29  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    30  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    31  Python                              0x000000010f822b57 PyEval_EvalCodeEx + 78
    32  Python                              0x000000010f7adcc3 function_call + 377
    33  Python                              0x000000010f78c1de PyObject_Call + 97
    34  Python                              0x000000010f79e8f0 method_call + 140
    35  Python                              0x000000010f78c1de PyObject_Call + 97
    36  Python                              0x000000010f7d6a7e slot_tp_init + 57
    37  Python                              0x000000010f7d3e03 type_call + 171
    38  Python                              0x000000010f78c1de PyObject_Call + 97
    39  Python                              0x000000010f828047 PyEval_EvalFrameEx + 21723
    40  Python                              0x000000010f82c02f fast_function + 213
    41  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    42  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    43  Python                              0x000000010f822b03 PyEval_EvalCode + 81
    44  Python                              0x000000010f8484d9 run_mod + 58
    45  Python                              0x000000010f8487ba PyRun_FileExFlags + 178
    46  Python                              0x000000010f847e0e PyRun_SimpleFileExFlags + 469
    47  Python                              0x000000010f85bd92 Py_Main + 3342
    48  Python                              0x000000010f77ee27 Python + 7719
    49  libdyld.dylib                       0x00007fff9ccef5ad start + 1
    50  ???                                 0x0000000000000002 0x0 + 2
)
2016-03-23 09:25:46.859 Python[40618:8434553] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7fd83376bd90'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff93588ae2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff8960173c objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff9358bb9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x00007fff934c4601 ___forwarding___ + 1009
    4   CoreFoundation                      0x00007fff934c4188 _CF_forwarding_prep_0 + 120
    5   Tk                                  0x00000001107a1958 TkpInit + 476
    6   Tk                                  0x000000011071ca7e Tk_Init + 1799
    7   _tkinter.cpython-35m-darwin.so      0x00000001105fbd6a Tcl_AppInit + 82
    8   _tkinter.cpython-35m-darwin.so      0x00000001105f731e _tkinter_create + 1112
    9   Python                              0x000000010f7c4ae9 PyCFunction_Call + 273
    10  Python                              0x000000010f8282eb PyEval_EvalFrameEx + 22399
    11  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    12  Python                              0x000000010f822b57 PyEval_EvalCodeEx + 78
    13  Python                              0x000000010f7adcc3 function_call + 377
    14  Python                              0x000000010f78c1de PyObject_Call + 97
    15  Python                              0x000000010f79e8f0 method_call + 140
    16  Python                              0x000000010f78c1de PyObject_Call + 97
    17  Python                              0x000000010f7d6a7e slot_tp_init + 57
    18  Python                              0x000000010f7d3e03 type_call + 171
    19  Python                              0x000000010f78c1de PyObject_Call + 97
    20  Python                              0x000000010f828047 PyEval_EvalFrameEx + 21723
    21  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    22  Python                              0x000000010f82c0af fast_function + 341
    23  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    24  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    25  Python                              0x000000010f82c0af fast_function + 341
    26  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    27  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    28  Python                              0x000000010f82c0af fast_function + 341
    29  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    30  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    31  Python                              0x000000010f822b57 PyEval_EvalCodeEx + 78
    32  Python                              0x000000010f7adcc3 function_call + 377
    33  Python                              0x000000010f78c1de PyObject_Call + 97
    34  Python                              0x000000010f79e8f0 method_call + 140
    35  Python                              0x000000010f78c1de PyObject_Call + 97
    36  Python                              0x000000010f7d6a7e slot_tp_init + 57
    37  Python                              0x000000010f7d3e03 type_call + 171
    38  Python                              0x000000010f78c1de PyObject_Call + 97
    39  Python                              0x000000010f828047 PyEval_EvalFrameEx + 21723
    40  Python                              0x000000010f82c02f fast_function + 213
    41  Python                              0x000000010f828180 PyEval_EvalFrameEx + 22036
    42  Python                              0x000000010f82b770 _PyEval_EvalCodeWithName + 1884
    43  Python                              0x000000010f822b03 PyEval_EvalCode + 81
    44  Python                              0x000000010f8484d9 run_mod + 58
    45  Python                              0x000000010f8487ba PyRun_FileExFlags + 178
    46  Python                              0x000000010f847e0e PyRun_SimpleFileExFlags + 469
    47  Python                              0x000000010f85bd92 Py_Main + 3342
    48  Python                              0x000000010f77ee27 Python + 7719
    49  libdyld.dylib                       0x00007fff9ccef5ad start + 1
    50  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
zsh: abort      dataexplore

CI: ImportError: Building pandas requires cython

Cython is needed in order for the Continuous Integration system to work.

    ImportError: Building pandas requires cython

    ----------------------------------------
    Command "/home/travis/virtualenv/python3.4.2/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-5xny5235/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wxzhxc9t-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/travis/virtualenv/python3.4.2/include/site/python3.4" failed with error code 1 in /tmp/pip-build-5xny5235/pandas

The command "pip install numpy matplotlib numexpr xlrd pandas" failed and exited with 1 during .

Your build has been stopped.

Improve compatibility with Anaconda and Python 2.7

With latest Anaconda and its private Python 2.7 (as a choice -- there's also a Python 3 version, but the user prefers 2.7), some imports of Tkinter do not work. In particular, when spelled with lower case tkinter or for some submodules, e.g. tkFont as tkinter.font.

With simple modification of imports following the try / except pattern, it is possible to address the issue. (See below.)

The following is reported by conda list:

anaconda                  2.4.1
python                    2.7.11
tk                        8.5.18

core.py

try:
    ...
    import tkinter.font
except:
    ...
    import tkFont as font

dialogs.py

try:
    import tkinter
    from tkinter import *
    ...
    from tkinter.scrolledtext import ScrolledText
except:
    import Tkinter
    from Tkinter import *
    ...
    import ScrolledText

headers.py

try:
    from tkinter import *
    ...
except:
    from Tkinter import *
    ...

images.py

try:
    import tkinter as tk
except:
    import Tkinter as tk

plugin.py

try:
    import tkinter
    from tkinter import *

    from tkinter.ttk import *
except:
    import Tkinter
    from Tkinter import *
    from ttk import *

preferences.py

try:
    from tkinter import *
    from tkinter.ttk import *
except:
    from Tkinter import *
    from ttk import *

stats.py

try:
    from tkinter import *

    from tkinter.ttk import *
except:
    from Tkinter import *
    from ttk import *

util.py

try:
    from tkinter import *
    from tkinter.ttk import *
except:
    from Tkinter import *
    from ttk import *

Memory Leak in Table class!

Each redraw of a Table instance consumes an average of 21kB RAM on an "empty" table.
With a filled Table it's even more.

To prove the problem, I wrote a small application which refreshes 100 times a second, calculates the average additional consumed memory and shows also the total consumed memory:

import psutil
import tkinter as tk
import pandastable

FREQ = 100  # redraws per second


def update_title():
    global N, S
    mem = me.memory_full_info().uss
    table.redraw()
    diff = me.memory_full_info().uss - mem
    S += diff
    N += 1
    root.title('total: {:.2f}MB - added per redraw: {:.2f}kB'
               .format(mem / 1000**2, (S/N)/1000))
    root.after(1000//FREQ, update_title)

if __name__ == '__main__':
    N = 0
    S = 0
    me = psutil.Process()
    root = tk.Tk()
    frame = tk.Frame(root)
    table = pandastable.Table(frame)
    table.show()
    frame.pack(fill='both', expand=True)
    root.after(100, update_title)
    smu = me.memory_full_info().uss
    root.mainloop()
    print('{:.2f}MB'.format((me.memory_full_info().uss-smu)/1000**2))

pandastable_memleak

Anyone get it worked on Mac?

Dear All, and Mr. Farrell,

Hi, this is Tiger.
I am on Mac OS , and I have installed this great package via
$sudo pip3 install pandastable

Then I create a file called test_panda.py,

import tkinter as tk
from pandastable import Table

root = tk.Tk()
pt = Table(root)
pt.show()
root.mainloop()

then I ran it via $python3 test_panda.py

it gives a bundle of exceptions as follows.

Any suggestions?

************** following are head part of the exceptions **************
2016-03-18 20:08:17.133 Python[4205:236546] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7f9a94376a20
2016-03-18 20:08:17.133 Python[4205:236546] An uncaught exception was raised
2016-03-18 20:08:17.133 Python[4205:236546] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7f9a94376a20
2016-03-18 20:08:17.133 Python[4205:236546] (
0 CoreFoundation 0x00007fff8e33cae2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff9889ff7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff8e33fb9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x00007fff8e278601 forwarding + 1009
4 CoreFoundation 0x00007fff8e278188 _CF_forwarding_prep_0 + 120
5 Tk 0x000000010ee15958 TkpInit + 476
6 Tk 0x000000010ed90a7e Tk_Init + 1799
7 _tkinter.cpython-35m-darwin.so 0x000000010ebbed62 Tcl_AppInit + 82
8 _tkinter.cpython-35m-darwin.so 0x000000010ebba206 _tkinter_create + 1119
9 Python 0x000000010e4a61e2 PyCFunction_Call + 273
10 Python 0x000000010e50cecf PyEval_EvalFrameEx + 24678

....... till error 28.

Please let me know your opinion .

Thanks

improve project loading speed

With multiple sheets loading is slowed down by plotting/widget loading all sheets at once
speed up loading times by avoiding plotting until tab is selected

core.py importerror

I have been having issues with loading tkinter. I use 2.7.8 and apparently tkinter is for 3. In the core.py file of in pandastable we have

"from tkinter import font"

outside the try statement for tkinter. I have to move the line into the try in order to get thing working again.

Figured I would tell you to either get an explanation or fix so i can pip again

Cheers

whish 2016

By order of (complex) whish:

  • match/do-better-than user simplicity of "excel slicers",
  • scale over 1 000 000 rows,
  • update goals and/or dates on your github milestones,
  • add "ttk" in your setup.py keywords.

Another Memory Leak in Table.updateModel

Dear Mr. Farrell,

I very much appreciate the time and effort you put into this project!
I'm glad that I found your project because otherwise I'd have to write my own table-widget for pandas.DataFrame.

After #47 was fixed, I found out that the consumed memory still grows when table data is updated via updateModel.
While looking at the code, I realized that parts of the UI are newly generated on each call of Table.show (which is called by updateModel) without "destroying" all old widgets properly.
To fix this, some bigger changes are required - I think.

This quick fix unluckily produces an error in some cases:

--- a/pandastable/core.py
+++ b/pandastable/core.py
@@ -2868,11 +2868,9 @@ class Table(Canvas):
         self.cols = self.model.getColumnCount()
         self.tablewidth = (self.cellwidth)*self.cols
         if hasattr(self, 'tablecolheader'):
-            self.tablecolheader.destroy()
-            self.rowheader.destroy()
             self.selectNone()
-        self.show()
-        return
+        else:
+            self.show()

     def new(self):
         """Clears all the data and makes a new table"""

Running my test program from below gives me following values for the current core.py:

38.30 cycles/second
23.59 kB/cycle
18.15 MB gained

After applying the patch from above:

58.35 cycles/second
0.52 kB/cycle
0.63 MB gained

Obviously the patch has also an effect on the performance. #31

test program:

import psutil
import tkinter as tk
import pandas
import pandastable

DURATION = 20  # seconds the program should run


def update_model():
    df = pandas.DataFrame(list(range(N, N+10)))
    table.updateModel(pandastable.TableModel(df))


def update_title(set_smu=False):
    global N, S
    if set_smu:
        global smu
        smu = me.memory_full_info().uss
    mem = me.memory_full_info().uss
    update_model()
    table.redraw()
    diff = me.memory_full_info().uss - mem
    S += diff
    N += 1
    root.title('total: {:.2f}MB - added per redraw: {:.2f}kB'
               .format(mem / 1000**2, (S/N)/1000))
    root.after(10, update_title)

if __name__ == '__main__':
    N = 0
    S = 0
    me = psutil.Process()
    root = tk.Tk()
    frame = tk.Frame(root)
    table = pandastable.Table(frame)
    table.show()
    frame.pack(fill='both', expand=True)
    root.after(1000, update_title, True)
    update_model()
    root.update()
    root.after(1000 + DURATION*1000, root.destroy)
    root.mainloop()
    print('{:.2f} cycles/second'.format(N/DURATION))
    print('{:.2f} kB/cycle'.format((S/N)/1000))
    print('{:.2f} MB gained'.format((me.memory_full_info().uss-smu)/1000**2))

date time index does not plot well and treated as string

when I try to plot a value vs. time it seems like the x-ticks treat the index date time as string rather than a datetime64. I used the internal conversion to datetime64 before plotting.
Moreover, I cannot seem to put plots grouped by in one plot with different colors rather than multiple plots.

Python shell with DataExplore?

It is possible to work with a Python console and DataExplore?

The idea would be to manipulate a Pandas dataframe and work with the results in DataExplore, much like the RStudio object viewer.

Make compatible with Python 2

Modify tkinter dependencies to work with either version of python. Most scientific python users and GIS platforms are still using python 2. Cross compatibility would be awesome. Maybe merge this library with your tkintertable app or add Pandas functionality to tkintertable?

AttributeError: 'Table' object has no attribute 'tablecolheader'

I get this error with this script:

from tkinter import Tk, Frame, mainloop
from pandastable import Table


def main():
    root = Tk()
    frame = Frame(root)

    table = Table(frame)
    table.importCSV("pacientes.csv")
    table.show()
    #table.redraw()

    mainloop()


if __name__ == '__main__':
    main()
runfile('C:/Users/personal/Documents/Python Scripts/pacientes.py', wdir='C:/Users/personal/Documents/Python Scripts/Pacientes')
Traceback (most recent call last):

  File "<ipython-input-2-0da4d8efad79>", line 1, in <module>
    runfile('C:/Users/personal/Documents/Python Scripts/pacientes.py', wdir='C:/Users/personal/Documents/Python Scripts/Pacientes')

  File "C:\Users\personal\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile
    execfile(filename, namespace)

  File "C:\Users\personal\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/personal/Documents/Python Scripts/pacientes.py", line 18, in <module>
    main()

  File "C:/Users/personal/Documents/Python Scripts/pacientes.py", line 10, in main
    table.importCSV("pacientes.csv")

  File "C:\Users\personal\Anaconda3\lib\site-packages\pandastable\core.py", line 2907, in importCSV
    self.updateModel(model)

  File "C:\Users\personal\Anaconda3\lib\site-packages\pandastable\core.py", line 2822, in updateModel
    self.tablecolheader.destroy()

AttributeError: 'Table' object has no attribute 'tablecolheader'

Feature wishes: implement dview-like data inspection features

Dear developer(s),

for environmental, meteo and engineering data, the following software has nice plotting features:
https://beopt.nrel.gov/downloadDView

Quick:

  • re-sampling from hourly daily, monthly
  • Heat Map
  • (daily / annual) Profile
  • Statistics
  • PDF/CDF
  • Duration curve
  • Scatter

Since Dview has no python power, it would be great t have the same functionality available in datatable.

OK, maybe I need to see if I could learn how to write a plugin....

AttributeError: 'Table' object has no attribute 'tablecolheader'

When I run using some of the calls you documented, I get the error shown in the subject line.

C:\Anaconda3\lib\site-packages\pandastable\core.py in updateModel(self, model)
2820 self.cols = self.model.getColumnCount()
2821 self.tablewidth = (self.cellwidth)*self.cols
-> 2822 self.tablecolheader.destroy()
2823 self.rowheader.destroy()
2824 self.selectNone()

AttributeError: 'Table' object has no attribute 'tablecolheader'
Here is the code:

    self.pt = pdt.Table(self.framee)
    self.pt.importCSV('charObs.csv')
    self.pt.show()

Using IronPython interpreter and Python 3.5.1

multiindex support

  • creating and dropping multiindexes from menu
  • rendering of multiindex to reflect grouping and level order

SubTables/Two tables with same data frame

Hi dmnfarrell,

I have been working on trying to make a subtable that is editable so that it is actually editing the main table. The idea is to jump the user right to the error that need to be corrected so that he can double click edit and press enter. My problem is that when I make two Tables: one with a df and the other with df.loc[1,1], for example, editing and updating the second table does not change the df of the original table. Does Table copy the df? Any suggestions of how to make an editable subtable that effects the original table? I am aware this is not an issue, i do not think, but I could really use some help and do not mind deleting if we delete this...

dataexplore crashes

when I try to run dataexplore it crashes the python interpreter. I am using python 3.5.1 and ironpython, tho it failed with the regular python interpreter as well.

when I try to run main.py directly I get the following error

C:\pandasTable>ipython main.py
C:\Anaconda3\lib\site-packages\matplotlib__init__.py:1350: UserWarning: This call to matplotlib.use() has no effect because the backend has already been chosen; matplotlib.use() must be called before pylab, matplotlib.pyplot, or matplotlib.backends is imported for the first time.

warnings.warn(_use_error_msg)
['example', 'ipythonview', 'rename', 'seabornplots']
[]

It does bring up an empty "frame" ; that is, a window which has an outer frame but is transparent otherwise.

I reported this in youtube

following this link I installed dataexplore: https://github.com/dmnfarrell/pandastable/wiki/Installation. but when I start it, it attempted to search my Python2.7-site-package where the dependency tkinter was named Tkinter in Python2.7 but tkinter in Python3 where dataexplore depends. Is there anyway to make it search my python3 site package where I intalled tkinter.
screen dump:
$ dataexplore
Traceback (most recent call last):
File "/usr/local/bin/dataexplore", line 9, in
load_entry_point('pandastable==0.4.0', 'gui_scripts', 'dataexplore')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 521, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2632, in load_entry_point
return ep.load()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2312, in load
return self.resolve()
File "/usr/lib/python2.7/dist-packages/pkg_resources/init.py", line 2318, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/usr/local/lib/python2.7/dist-packages/pandastable/init.py", line 1, in
from .core import *
File "/usr/local/lib/python2.7/dist-packages/pandastable/core.py", line 22, in
from tkinter import *
ImportError: No module named tkinter
** Thank you very much **

Throws "truth value of a DataFrame is ambiguous" error

Using python 3.5 on Windows 10
After successfully running pip install pandastable

In IPython shell I do (per the example):
`import pandas as pd
from tkinter import *
from pandastable import Table

data = {
'A': [10, 11, 12],
'B': [20, 21, 22],
'C': ['Peter Pan', 'Cpt. Hook', 'Tinkerbell']
}
df = pd.DataFrame(data)
pt = Table(df)
pt.show()`

The error trace is:

Traceback (most recent call last):
File "C:\Users\Sonya\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 2885, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
pt = Table(df)
File "C:\Users\Sonya\Anaconda3\lib\site-packages\pandastable\core.py", line 58, in init
scrollregion=(0,0,300,200))
File "C:\Users\Sonya\Anaconda3\lib\tkinter_init_.py", line 2244, in init
Widget.init(self, master, 'canvas', cnf, kw)
File "C:\Users\Sonya\Anaconda3\lib\tkinter_init_.py", line 2131, in init
BaseWidget.setup(self, master, cnf)
File "C:\Users\Sonya\Anaconda3\lib\tkinter_init
.py", line 2104, in _setup
if not master:
File "C:\Users\Sonya\Anaconda3\lib\site-packages\pandas\core\generic.py", line 731, in nonzero
.format(self.class.name))
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

how to run on linux?

Installing as
pip3 --user pandastable

There is no executable installed (into e.g., .local/bin). How is the app started?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.