tablexplore package
Submodules
tablexplore.app module
TablExplore app Created November 2020 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- class tablexplore.app.Application(project_file=None, csv_file=None, excel_file=None)[source]
Bases:
QMainWindow
- do_saveProject(filename, progress_callback=None)[source]
Does the actual saving. Save sheets inculding table dataframes and meta data as dict to compressed pickle.
- loadMeta(table, meta)[source]
Load meta data for a sheet/table, this includes plot options and table selections
- load_dataframe(df, name=None, select=False)[source]
Load a DataFrame into a new sheet :param df: dataframe :param name: name of new sheet :param select: set new sheet as selected
- run_threaded_process(process, on_complete)[source]
Execute a function in the background with a worker
- saveMeta(tablewidget)[source]
Save meta data such as current plot options and certain table attributes. These are re-loaded when the sheet is opened.
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
tablexplore.core module
Implements core classes for tablexplore Created May 2017 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- class tablexplore.core.ColumnHeader[source]
Bases:
QHeaderView
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.core.DataFrameModel(dataframe=None, *args)[source]
Bases:
QAbstractTableModel
DataFrame Model class.
- columnCount(self, parent: PySide2.QtCore.QModelIndex = Invalid(PySide2.QtCore.QModelIndex)) int [source]
- data(index, role=PySide2.QtCore.Qt.ItemDataRole.DisplayRole)[source]
Edit or display roles. Handles what happens when the Cells are edited or what appears in each cell. https://www.pythonguis.com/tutorials/pyside-qtableview-modelviews-numpy-pandas/
- rowCount(self, parent: PySide2.QtCore.QModelIndex = Invalid(PySide2.QtCore.QModelIndex)) int [source]
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.core.DataFrameTable(parent=None, dataframe=None, font='Arial', fontsize=12, columnwidth=80, timeformat='%m-%d-%Y', bg='#F4F4F3', **kwargs)[source]
Bases:
QTableView
QTableView with pandas DataFrame as model.
- setSelected(rows, cols)[source]
Set selection programmatically from a list of rows and cols. https://doc.qt.io/archives/qtjambi-4.5.2_01/com/trolltech/qt/model-view-selection.html
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.core.DataFrameWidget(parent=None, dataframe=None, app=None, toolbar=True, statusbar=True, **kwargs)[source]
Bases:
QWidget
Widget containing a tableview and toolbars
- applyColumnFunction(column)[source]
Apply column wise functions, applies a calculation per row and ceates a new column.
- applyTransformFunction(column)[source]
Apply resampling and transform functions on a single column.
- convertDates(column)[source]
Convert single or multiple columns into datetime or extract features from datetime object.
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.core.HeaderProxyStyle[source]
Bases:
QProxyStyle
- drawControl(self, element: PySide2.QtWidgets.QStyle.ControlElement, option: PySide2.QtWidgets.QStyleOption, painter: PySide2.QtGui.QPainter, widget: Union[PySide2.QtWidgets.QWidget, NoneType] = None) None [source]
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.core.HeaderView(parent)[source]
Bases:
QHeaderView
” Column header class.
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.core.RowHeader[source]
Bases:
QHeaderView
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.core.SubTableWidget(parent=None, dataframe=None, **args)[source]
Bases:
DataFrameWidget
Widget for sub table
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
tablexplore.dialogs module
Implements some dialog utilities for tablexplore Created Feb 2019 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- class tablexplore.dialogs.AggregateDialog(parent, df, title='Groupby-Aggregate')[source]
Bases:
BasicDialog
Qdialog with multiple inputs
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.BasicDialog(parent, df, title=None, app=None)[source]
Bases:
QDialog
Qdialog for table operations interfaces
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.ColorButton(*args, color=None, **kwargs)[source]
Bases:
QPushButton
Custom Qt Widget to show a chosen color.
Left-clicking the button shows the color-chooser, while right-clicking resets the color to None (no-color).
- colorChanged
- onColorPicker()[source]
Show color-picker dialog to select color. Qt will use the native dialog by default.
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.ComboDelegate(parent, items)[source]
Bases:
QItemDelegate
A delegate to add QComboBox in every cell of the given column
- createEditor(self, parent: PySide2.QtWidgets.QWidget, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) PySide2.QtWidgets.QWidget [source]
- setEditorData(self, editor: PySide2.QtWidgets.QWidget, index: PySide2.QtCore.QModelIndex) None [source]
- setModelData(self, editor: PySide2.QtWidgets.QWidget, model: PySide2.QtCore.QAbstractItemModel, index: PySide2.QtCore.QModelIndex) None [source]
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.ConvertTypesDialog(parent, df, title='Convert types')[source]
Bases:
BasicDialog
Dialog to melt table
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.FilterBar(parent, table)[source]
Bases:
QWidget
Single Widget based filter
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.FilterDialog(parent, table, title=None, app=None)[source]
Bases:
QWidget
Qdialog for table query/filtering
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.FindReplaceDialog(parent, table, title=None, app=None)[source]
Bases:
QWidget
Qdialog for table query/filtering
- find()[source]
Do string search. Creates a masked dataframe for results and then stores each cell coordinate in a list.
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.ImportDialog(parent=None, filename=None)[source]
Bases:
QDialog
Provides a dialog for import settings
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.ManageColumnsDialog(parent, df, title='Manage Columns', app=None)[source]
Bases:
BasicDialog
Qdialog for column re-arranging
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.MeltDialog(parent, df, title='Melt')[source]
Bases:
BasicDialog
Dialog to melt table
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.MergeDialog(parent, df, df2=None, title='Merge Tables', app=None)[source]
Bases:
BasicDialog
Dialog to melt table
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.MultipleFilesDialog(parent, title='Import Multiple')[source]
Bases:
QDialog
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.MultipleInputDialog(parent, options=None, title='Input', width=400, height=200)[source]
Bases:
QDialog
Qdialog with multiple inputs
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.PivotDialog(parent, df, title='Pivot')[source]
Bases:
BasicDialog
Dialog to pivot table
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.PlainTextEditor(parent=None, **kwargs)[source]
Bases:
QPlainTextEdit
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.PreferencesDialog(parent, options={})[source]
Bases:
QDialog
Preferences dialog from config parser options
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.ProgressWidget(parent=None, label='')[source]
Bases:
QDialog
Progress widget class
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.SimpleDialog(parent, title=None)[source]
Bases:
QDialog
Qdialog for generic operations
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.TextDialog(parent, text='', title='Text', width=400, height=300)[source]
Bases:
QDialog
Text edit dialog
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.dialogs.Worker(fn, *args, **kwargs)[source]
Bases:
QRunnable
Worker thread for running background tasks.
- class tablexplore.dialogs.WorkerSignals[source]
Bases:
QObject
Defines the signals available from a running worker thread. Supported signals are: finished
No data
- error
tuple (exctype, value, traceback.format_exc() )
- result
object data returned from processing, anything
- error
- finished
- progress
- result
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- tablexplore.dialogs.addToolBarItems(toolbar, parent, items)[source]
Populate toolbar from dict of items
- tablexplore.dialogs.dialogFromOptions(parent, opts, sections=None, wrap=2, section_wrap=4, style=None)[source]
Get Qt widgets dialog from a dictionary of options. :param opts: options dictionary :param sections: :param section_wrap: how many sections in one row :param style: stylesheet css if required
- tablexplore.dialogs.getName(parent, current='', txt='Enter value')[source]
Wrapper for text inpuit dialog
tablexplore.interpreter module
Implements a Python interpreter From original code from https://github.com/col-one/thonside
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- class tablexplore.interpreter.Interpreter(extra_context={}, stream_out=True, stream_err=True, table=None, app=None)[source]
Bases:
InteractiveConsole
- interact(banner=None, exitmsg=None)[source]
Starting point for the interpreter. It is override for avoid while loop as classic shell. In this context interpreter doesn’t use this functionality. :param banner: starter text :param exitmsg: no used :return:
- raw_input(prompt='')[source]
Override InteractiveConsole.raw_input method to add a ‘slot’ connection, useful for different view implementation. :param prompt: str prompt to write :return:
- run(code)[source]
Manage run code, like continue if : or ( with prompt switch >>> to … :param code: str code to run :return:
tablexplore.plotting module
tableexplore plotting module Created May 2017 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- class tablexplore.plotting.AnnotationOptions[source]
Bases:
BaseOptions
This class also provides custom tools for adding items to the plot
- class tablexplore.plotting.AxesOptions[source]
Bases:
BaseOptions
Class for additional formatting options like styles
- class tablexplore.plotting.BaseOptions[source]
Bases:
object
Class to generate widget dialog for dict of options
- class tablexplore.plotting.FormatOptions[source]
Bases:
BaseOptions
This class also provides custom tools for adding items to the plot
- class tablexplore.plotting.MPLBaseOptions[source]
Bases:
BaseOptions
Class to provide a dialog for matplotlib options and returning the selected prefs
- legendlocs = ['best', 'upper right', 'upper left', 'lower left', 'lower right', 'right', 'center left', 'center right', 'lower center', 'upper center', 'center']
- class tablexplore.plotting.PlotViewer(table, parent=None)[source]
Bases:
QWidget
Plot viewer class
- customiseSeries()[source]
Show custom options for current plot series. Allows plot types to be specified per series and uses a custom plot function.
- plot2D(redraw=True)[source]
Plot method for current data. Relies on pandas plot functionality if possible. There is some temporary code here to make sure only the valid plot options are passed for each plot kind.
- scatter(df, ax, axes_layout='single', alpha=0.8, marker='o', color=None, **kwds)[source]
A custom scatter plot rather than the pandas one. By default this plots the first column selected versus the others
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.plotting.PlotWidget(parent=None, figure=None, dpi=100, hold=False)[source]
Bases:
FigureCanvasQTAgg
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.plotting.SeriesOptions(plotviewer)[source]
Bases:
BaseOptions
Class for selecting custom plot types for each series
tablexplore.plugin module
TablExplore plugin class Created January 2021 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- class tablexplore.plugin.Plugin(parent=None)[source]
Bases:
object
Base Plugin class, should be inherited by any plugin
- capabilities = []
- createWidgets(width=600, height=600)[source]
Create main widget with GUI elements. This will be specific to the plugin so it must be overrriden.
- requires = []
- tablexplore.plugin.describe_class(obj)[source]
Describe the class object passed as argument, including its methods
- tablexplore.plugin.describe_func(obj, method=False)[source]
Describe the function object passed as argument. If this is a method object, the second argument will be passed as True
tablexplore.qt module
TablExplore app Created January 2021 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
tablexplore.terminal module
Implements some dialog utilities for tableexplore Created Feb 2019 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- class tablexplore.terminal.ExecThread[source]
Bases:
QObject
- cmd = None
- def_to_run = None
- finished
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.terminal.QueueReceiver(queue, *args, **kwargs)[source]
Bases:
QObject
- sent
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- class tablexplore.terminal.Terminal(parent=None, hist_file=None)[source]
Bases:
QPlainTextEdit
- autocomplete(command)[source]
Ask different possibility from command arg, proposition is limited by AUTOCOMPLETE_LIMIT constant :param command: str :return: list of proposition
- count_cursor_lines()[source]
Slot def keep tracking cursor position line number. Useful to compare position to know if it is an editable line or not. :return:
- get_previous_history()[source]
Get previous history in the readline GNU history file. :return: str history
- init_history(hist_file)[source]
History initialisation with readline GNU, and use hook atexit for save history when program closing. :param hist_file: history file path :return:
- press_enter
- remove_last_command()[source]
Remove current command. Useful for display history navigation. :return:
- save_history(hist_file)[source]
Hook def execute by atexit. :param hist_file: history file path :return:
- staticMetaObject = <PySide2.QtCore.QMetaObject object>
- write(data)[source]
Append text to the Terminal. And keep cursor at the end. :param data: str data to write. :return:
tablexplore.util module
Implements the utility methods for tableexplore classes. Created August 2015 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- tablexplore.util.adjustColorMap(cmap, minval=0.0, maxval=1.0, n=100)[source]
Adjust colormap to avoid using white in plots
- tablexplore.util.colorScale(hex_color, brightness_offset=1)[source]
Takes a hex color and produces a lighter or darker variant. :returns: new color in hex format
- tablexplore.util.gen_colors(cmap, n, reverse=False)[source]
Generates n distinct color from a given colormap. :param cmap: The name of the colormap you want to use.
Refer https://matplotlib.org/stable/tutorials/colors/colormaps.html to choose Suggestions: For Metallicity in Astrophysics: Use coolwarm, bwr, seismic in reverse For distinct objects: Use gnuplot, brg, jet,turbo.
- Parameters:
n (int) – Number of colors you want from the cmap you entered.
reverse (bool) – False by default. Set it to True if you want the cmap result to be reversed.
- Returns:
A list with hex values of colors.
- Return type:
colorlist(list)
Taken from the mycolorpy package by binodbhttr see also https://matplotlib.org/stable/tutorials/colors/colormaps.html
- tablexplore.util.getAttributes(obj)[source]
Get non hidden and built-in type object attributes that can be persisted
- tablexplore.util.get_user_config_directory()[source]
Returns a platform-specific root directory for user config settings.
- tablexplore.util.random_colors(n=10, seed=1)[source]
Generate random hex colors as list of length n.
tablexplore.widgets module
Implements various widgets for tablexplore Created Oct 2021 Copyright (C) Damien Farrell
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA