A widget to display and edit DataFrames

Classes:

DataFrameDock

The QDockWidget for the DataFrameEditor

DataFrameEditor(*args, **kwargs)

An editor for data frames

DataFrameModel(df[, parent, index_editable, ...])

DataFrame Table Model

DataFrameView(df, parent, *args, **kwargs)

Data Frame view class

FrozenTableView(parent)

This class implements a table with its first column frozen For more information please see: http://doc.qt.io/qt-5/qtwidgets-itemviews-frozencolumn-example.html

Functions:

bool_false_check(value)

Used to convert bool intrance to false since any string in bool('') will return True

class psyplot_gui.dataframeeditor.DataFrameDock[source]

Bases: QDockWidget

The QDockWidget for the DataFrameEditor

Methods:

close()

Reimplemented to remove the dock widget from the mainwindow when closed

close()[source]

Reimplemented to remove the dock widget from the mainwindow when closed

class psyplot_gui.dataframeeditor.DataFrameEditor(*args, **kwargs)[source]

Bases: DockMixin, QWidget

An editor for data frames

Attributes:

cell_edited(*args, **kwargs)

A signal that is emitted when a cell has been changed.

cleared(*args, **kwargs)

A signal that is emitted, if the table is cleared

hidden

bool(x) -> bool

rows_inserted(*args, **kwargs)

A signal that is emitted, if rows have been inserted into the dataframe.

Methods:

clear_table()

Clear the table and emit the cleared signal

close(self)

maybe_tabify()

open_dataframe([fname])

Opens a file dialog and the dataset that has been inserted

set_df(df, *args, **kwargs)

Fill the table from a DataFrame

set_dtypes_changeable(state)

Set the DataFrameModel.dtypes_changeable attribute

set_index_editable(state)

Set the DataFrameModel.index_editable attribute

set_lbl_size_text([nrows, ncols])

Set the text of the lbl_size label to display the size

to_dock(main, *args, **kwargs)

toggle_fmt_button(text)

update_format()

Update the format of the table

update_index_editable()

Classes:

dock_cls

alias of DataFrameDock

cell_edited(*args, **kwargs)

A signal that is emitted when a cell has been changed. The argument is a tuple of two integers and one float: the row index, the column index and the new value

clear_table()[source]

Clear the table and emit the cleared signal

cleared(*args, **kwargs)

A signal that is emitted, if the table is cleared

close(self) bool[source]
dock_cls

alias of DataFrameDock Methods:

close()

Reimplemented to remove the dock widget from the mainwindow when closed

property hidden

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

maybe_tabify()[source]
open_dataframe(fname=None, *args, **kwargs)[source]

Opens a file dialog and the dataset that has been inserted

rows_inserted(*args, **kwargs)

A signal that is emitted, if rows have been inserted into the dataframe. The first value is the integer of the (original) position of the row, the second one is the number of rows

set_df(df, *args, **kwargs)[source]

Fill the table from a DataFrame

Parameters:
  • df (pandas.DataFrame) – The data frame that will be shown by this DataFrameModel instance

  • index_editable (bool) – True if the index should be modifiable by the user

  • dtypes_changeable (bool) – True, if the data types should be modifiable by the user

  • show (bool) – If True (default), show and raise_ the editor

set_dtypes_changeable(state)[source]

Set the DataFrameModel.dtypes_changeable attribute

set_index_editable(state)[source]

Set the DataFrameModel.index_editable attribute

set_lbl_size_text(nrows=None, ncols=None)[source]

Set the text of the lbl_size label to display the size

to_dock(main, *args, **kwargs)[source]
toggle_fmt_button(text)[source]
update_format()[source]

Update the format of the table

update_index_editable()[source]
class psyplot_gui.dataframeeditor.DataFrameModel(df, parent=None, index_editable=True, dtypes_changeable=True)[source]

Bases: QAbstractTableModel

DataFrame Table Model

Attributes:

COLS_TO_LOAD

ROWS_TO_LOAD

Methods:

bgcolor(state)

Toggle backgroundcolor

can_fetch_more([rows, columns])

columnCount([index])

DataFrame column number

data(index[, role])

Cell content

fetch_more([rows, columns])

flags(index)

Set flags

get_format()

Return current format

get_value(row, column)

Returns the value of the DataFrame

headerData(section, orientation[, role])

Set header data

insertRow(irow)

Insert one row into the df

insertRows(irow[, nrows])

Insert a row into the df

reset()

rowCount([index])

DataFrame row number

setData(index, value[, role, change_type])

Cell content change

set_format(format)

Change display format

sort(column[, order, return_check, report])

Overriding sort method

update_df_index()

"Update the DataFrame index

COLS_TO_LOAD = 40
ROWS_TO_LOAD = 500
bgcolor(state)[source]

Toggle backgroundcolor

can_fetch_more(rows=False, columns=False)[source]
columnCount(index=<PyQt5.QtCore.QModelIndex object>)[source]

DataFrame column number

data(index, role=0)[source]

Cell content

fetch_more(rows=False, columns=False)[source]
flags(index)[source]

Set flags

get_format()[source]

Return current format

get_value(row, column)[source]

Returns the value of the DataFrame

headerData(section, orientation, role=0)[source]

Set header data

insertRow(irow)[source]

Insert one row into the df

Parameters:

irow (int) – The row index. If iRow is equal to the length of the df, the new row will be appended.

insertRows(irow, nrows=1)[source]

Insert a row into the df

Parameters:
  • irow (int) – The row index. If irow is equal to the length of the df, the rows will be appended.

  • nrows (int) – The number of rows to insert

reset()[source]
rowCount(index=<PyQt5.QtCore.QModelIndex object>)[source]

DataFrame row number

setData(index, value, role=2, change_type=None)[source]

Cell content change

set_format(format)[source]

Change display format

sort(column, order=0, return_check=False, report=True)[source]

Overriding sort method

update_df_index()[source]

“Update the DataFrame index

class psyplot_gui.dataframeeditor.DataFrameView(df, parent, *args, **kwargs)[source]

Bases: QTableView

Data Frame view class

Methods:

change_type(func)

A function that changes types of cells

contextMenuEvent(event)

Reimplement Qt method

copy()

Copy text to clipboard

insert_row_above_selection()

Insert rows above the selection

insert_row_below_selection()

Insert rows below the selection

load_more_data(value[, rows, columns])

moveCursor(cursor_action, modifiers)

Update the table position.

reset_model()

resizeEvent(event)

Update the frozen column dimensions.

scrollTo(index, hint)

Scroll the table.

set_df(df, *args, **kwargs)

Set the DataFrame for this table

set_index([append])

Set the index from the selected columns

setup_menu()

Setup context menu

sortByColumn(index)

Implement a Column sort

update_section_height(logical_index, ...)

Update the vertical width of the frozen column when a change takes place on any of the rows

update_section_width(logical_index, ...)

Update the horizontal width of the frozen column when a change takes place in the first column of the table

Attributes:

filled

True if the table is filled with content

change_type(func)[source]

A function that changes types of cells

contextMenuEvent(event)[source]

Reimplement Qt method

copy()[source]

Copy text to clipboard

property filled

True if the table is filled with content

insert_row_above_selection()[source]

Insert rows above the selection

The number of rows inserted depends on the number of selected rows

insert_row_below_selection()[source]

Insert rows below the selection

The number of rows inserted depends on the number of selected rows

load_more_data(value, rows=False, columns=False)[source]
moveCursor(cursor_action, modifiers)[source]

Update the table position.

Updates the position along with the frozen column when the cursor (selector) changes its position

reset_model()[source]
resizeEvent(event)[source]

Update the frozen column dimensions.

Updates takes place when the enclosing window of this table reports a dimension change

scrollTo(index, hint)[source]

Scroll the table.

It is necessary to ensure that the item at index is visible. The view will try to position the item according to the given hint. This method does not takes effect only if the frozen column is scrolled.

set_df(df, *args, **kwargs)[source]

Set the DataFrame for this table

Parameters:
  • df (pandas.DataFrame) – The data frame that will be shown by this DataFrameModel instance

  • index_editable (bool) – True if the index should be modifiable by the user

  • dtypes_changeable (bool) – True, if the data types should be modifiable by the user

set_index(append=False)[source]

Set the index from the selected columns

setup_menu()[source]

Setup context menu

sortByColumn(index)[source]

Implement a Column sort

update_section_height(logical_index, old_size, new_size)[source]

Update the vertical width of the frozen column when a change takes place on any of the rows

update_section_width(logical_index, old_size, new_size)[source]

Update the horizontal width of the frozen column when a change takes place in the first column of the table

class psyplot_gui.dataframeeditor.FrozenTableView(parent)[source]

Bases: QTableView

This class implements a table with its first column frozen For more information please see: http://doc.qt.io/qt-5/qtwidgets-itemviews-frozencolumn-example.html

Methods:

contextMenuEvent(event)

Show the context Menu

update_geometry()

Update the frozen column size when an update occurs in its parent table

contextMenuEvent(event)[source]

Show the context Menu

Reimplemented to show the use the contextMenuEvent of the parent

update_geometry()[source]

Update the frozen column size when an update occurs in its parent table

psyplot_gui.dataframeeditor.bool_false_check(value)[source]

Used to convert bool intrance to false since any string in bool(‘’) will return True