Skip to content

Commit

Permalink
DOCS-quantopian#22: Move features section
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Lin <[email protected]>
  • Loading branch information
richardlin047 committed Mar 27, 2021
1 parent b24a3bf commit 252e4bf
Showing 1 changed file with 40 additions and 42 deletions.
82 changes: 40 additions & 42 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,47 +51,6 @@ If needed, Modin-spreadsheet can be installed through PyPi. ::

pip install modin-spreadsheet

Features
----------
**Column-specific options**:
The feature enables the ability to set options on a per column basis. This allows you to do things like explicitly
specify which column should be sortable, editable, etc. For example, if you wanted to prevent editing on all columns
except for a column named `'A'`, you could do the following::

col_opts = { 'editable': False }
col_defs = { 'A': { 'editable': True } }
modin_spreadsheet.show_grid(df, column_options=col_opts, column_definitions=col_defs)

See the `show_grid <https://qgrid.readthedocs.io/en/v1.1.0/#qgrid.show_grid>`_ documentation for more information.

**Disable editing on a per-row basis**:
This feature allows a user to specify whether or not a particular row should be editable. For example, to make it so
only rows in the grid where the `'status'` column is set to `'active'` are editable, you might use the following code::

def can_edit_row(row):
return row['status'] == 'active'

modin_spreadsheet.show_grid(df, row_edit_callback=can_edit_row)

**Dynamically update an existing spreadsheet widget**:
These API allow users to programmatically update the state of an existing spreadsheet widget:

- `edit_cell <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.edit_cell>`_
- `change_selection <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.change_selection>`_
- `toggle_editable <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.toggle_editable>`_
- `change_grid_option <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.change_grid_option>`_ (experimental)

**MultiIndex Support**:
Modin-spreadsheet displays multi-indexed DataFrames with some of the index cells merged for readability, as is normally
done when viewing DataFrames as a static html table. The following image shows Modin-spreadsheet displaying a
multi-indexed DataFrame:

.. figure:: https://s3.amazonaws.com/quantopian-forums/pipeline_with_qgrid.png
:align: left
:target: https://s3.amazonaws.com/quantopian-forums/pipeline_with_qgrid.png
:width: 100px


Running from source & testing your changes
------------------------------------------

Expand Down Expand Up @@ -136,8 +95,47 @@ Running automated tests
There is a small python test suite which can be run locally by running the command ``pytest`` in the root folder
of the repository.

Events API
Features
----------
**Column-specific options**:
The feature enables the ability to set options on a per column basis. This allows you to do things like explicitly
specify which column should be sortable, editable, etc. For example, if you wanted to prevent editing on all columns
except for a column named `'A'`, you could do the following::

col_opts = { 'editable': False }
col_defs = { 'A': { 'editable': True } }
modin_spreadsheet.show_grid(df, column_options=col_opts, column_definitions=col_defs)

See the `show_grid <https://qgrid.readthedocs.io/en/v1.1.0/#qgrid.show_grid>`_ documentation for more information.

**Disable editing on a per-row basis**:
This feature allows a user to specify whether or not a particular row should be editable. For example, to make it so
only rows in the grid where the `'status'` column is set to `'active'` are editable, you might use the following code::

def can_edit_row(row):
return row['status'] == 'active'

modin_spreadsheet.show_grid(df, row_edit_callback=can_edit_row)

**Dynamically update an existing spreadsheet widget**:
These API allow users to programmatically update the state of an existing spreadsheet widget:

- `edit_cell <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.edit_cell>`_
- `change_selection <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.change_selection>`_
- `toggle_editable <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.toggle_editable>`_
- `change_grid_option <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.change_grid_option>`_ (experimental)

**MultiIndex Support**:
Modin-spreadsheet displays multi-indexed DataFrames with some of the index cells merged for readability, as is normally
done when viewing DataFrames as a static html table. The following image shows Modin-spreadsheet displaying a
multi-indexed DataFrame:

.. figure:: https://s3.amazonaws.com/quantopian-forums/pipeline_with_qgrid.png
:align: left
:target: https://s3.amazonaws.com/quantopian-forums/pipeline_with_qgrid.png
:width: 100px

**Events API**:
The Events API provides ``on`` and ``off`` methods which can be used to attach/detach event handlers. They're available
on both the ``modin_spreadsheet`` module (see `qgrid.on <https://qgrid.readthedocs.io/en/latest/#qgrid.on>`_), and on
individual SpreadsheetWidget instances (see `qgrid.QgridWidget.on <https://qgrid.readthedocs.io/en/latest/#qgrid.QgridWidget.on>`_).
Expand Down

0 comments on commit 252e4bf

Please sign in to comment.