A widget to display and edit DataFrames
Classes:
The QDockWidget for the |
|
|
An editor for data frames |
|
DataFrame Table Model |
|
Data Frame view class |
|
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:
|
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
- 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
bool(x) -> bool
rows_inserted
(*args, **kwargs)A signal that is emitted, if rows have been inserted into the dataframe.
Methods:
Clear the table and emit the
cleared
signalclose
(self)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
attributeset_index_editable
(state)Set the
DataFrameModel.index_editable
attributeset_lbl_size_text
([nrows, ncols])Set the text of the
lbl_size
label to display the sizeto_dock
(main, *args, **kwargs)toggle_fmt_button
(text)Update the format of the table
Classes:
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
- cleared(*args, **kwargs)
A signal that is emitted, if the table is cleared
- dock_cls
alias of
DataFrameDock
Methods:close
()Reimplemented to remove the dock widget from the mainwindow when closed
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.
- 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
instanceindex_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
- class psyplot_gui.dataframeeditor.DataFrameModel(df, parent=None, index_editable=True, dtypes_changeable=True)[source]
Bases:
QAbstractTableModel
DataFrame Table Model
Attributes:
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
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 the DataFrame index
- COLS_TO_LOAD = 40
- ROWS_TO_LOAD = 500
- 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.
- 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 rows above the selection
Insert rows below the selection
load_more_data
(value[, rows, columns])moveCursor
(cursor_action, modifiers)Update the table position.
resizeEvent
(event)Update the frozen column dimensions.
scrollTo
(index, hint)Scroll the table.
set_df
(df, *args, **kwargs)Set the
DataFrame
for this tableset_index
([append])Set the index from the selected columns
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:
True if the table is filled with content
- 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
- moveCursor(cursor_action, modifiers)[source]
Update the table position.
Updates the position along with the frozen column when the cursor (selector) changes its position
- 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
instanceindex_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
Setup context menu
- 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 the frozen column size when an update occurs in its parent table