Code Monkey home page Code Monkey logo

ipyregulartable's Introduction

Build Status Coverage PyPI Version NPM Version License FINOS Incubating Binder

An ipywidgets wrapper of regular-table for Jupyter.

Examples

Two Billion Rows

Notebook

Click Events

Notebook

Edit Events

Notebook

Styling

Notebook

Pandas Data Model

For interactive/streaming sorting/pivoting/aggregation, take a look at Perspective, Streaming pivot visualization via WebAssembly, which also leverages regular-table.

Notebook

Series

DataFrame

DataFrame - Row Pivots

DataFrame - Column Pivots

DataFrame - Pivot Table

Installation

PyPI

ipyregulartable is available on PyPI:

pip install ipyregulartable

Conda

ipyregulartable is also available on conda-forge:

conda install -c conda-forge ipyregulartable

Jupyter Server/JupyterLab Extension

 jupyter labextension install ipyregulartable
 jupyter serverextension enable --py ipyregulartable

If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable the nbextension:

jupyter nbextension enable --py [--sys-prefix|--user|--system] ipyregulartable

Data Model

It is very easy to construct a custom data model. Just implement the abstract methods on the base DataModel class.

class DataModel(with_metaclass(ABCMeta)):
    @abstractmethod
    def editable(self, x, y):
        '''Given an (x,y) coordinate, return if its editable or not'''

    @abstractmethod
    def rows(self):
        '''return total number of rows'''

    @abstractmethod
    def columns(self):
        '''return total number of columns'''

    @abstractmethod
    def dataslice(self, x0, y0, x1, y1):
        '''get slice of data from (x0, y0) to (x1, y1) inclusive'''

Any DataModel object can be provided as the argument to RegularTableWidget. Note that regular-table may make probing calls of the form (0, 0, 0, 0) to assess data limits.

Development

See CONTRIBUTING.md for guidelines.

License

This software is licensed under the Apache 2.0 license. See the LICENSE and AUTHORS files for details.

ipyregulartable's People

Contributors

bollwyvl avatar dependabot[bot] avatar njwhite avatar timkpaine 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

ipyregulartable's Issues

More extensive documentation request and some user questions.

This seems an amazing library, but nowhere is clearly explained exactly how you are supposed to update the data in the table, how to access the underlying data structures, and much more. As an example, I'm trying to display the table inside an ipywidget box, and I don't know if it's possible and which function should I use. A practical example of how to construct DataModel class would be very useful too.
Lastly I am using get_state() and setData() to get the data from the table w and to change em, is there any easier way to get the data from the table if using pandas DataFrames like for example a w.to_dataframe() method?

EDIT: I see that using w.datamodel._data i can access the underlying dataframe, but if I change it the table widget doesn't update,is there a way to the refresh the view programmatically?

Install

Is there a working example?

Readonly pandas dataframe grid

Thanks for this very good component
could be helpful to add an example of read-only grid.

Here is a skeleton:

query = ""  # ...
engine = None #...
description = pd.read_sql_query(query, engine) # add some more context
class DataFrameModel_noedit(rt.datamodel.pandas.DataFrameDataModel):
    def editable(self, x, y):
        return False
    
w1 = rt.RegularTableWidget()
w1.datamodel = DataFrameModel_noedit(description)
w1

Leverage emerging regular-table extension system

Packaging for conda-forge?

Hi folks! Congrats on the release!

I'd ❤️ to package this for conda-forge, and am noticing a few irregular things in the metadata/build:

  • ensure_python says (('2.7', '>=3.7')) but the trove classifiers claim 3.6
    • which is right? or is *.7 only required for the build?
  • the source tarballs doesn't include the js/lib
    • yeah, i know it says "source" on the tin, but i don't think it's generally expected that a pip install needs node (much less yarn) at install time, when error messages can get very buried
      • proposal: include the built js in the sdist

Happy to PR some of these things!

Consider making widget loading lazy in lab?

Thanks again for this extension!

Another thing I noticed while looking into #23: once enough heavy labextensions are loaded in lab2, the build can start failing because webpack runs out of RAM/open file handles.

Changing the exports when registering the extension to be lazy loading with await import allows the downloading of the widget (and dependencies) to be deferred until the widget is actually requested, and not block the moon animation.

In this case, it knocks 7mb off the main bundle in development (already 30mb), while similarly taking 600kb off the production build (4.5mb)

diff --git a/js/src/plugin.ts b/js/src/plugin.ts
index ca5e534..938fe5b 100644
--- a/js/src/plugin.ts
+++ b/js/src/plugin.ts
@@ -18,7 +18,6 @@ import {
   IJupyterWidgetRegistry,
 } from "@jupyter-widgets/base";
 
-import * as widgetExports from "./widget";
 
 import {
   MODULE_VERSION,
@@ -44,7 +43,7 @@ export default examplePlugin;
  */
 function activateWidgetExtension(app: Application<Widget>, registry: IJupyterWidgetRegistry): void {
   registry.registerWidget({
-    exports: widgetExports,
+    exports: async () => await import(/* webpackChunkName: "ipyregulartable" */ "./widget"),
     name: "ipyregulartable",
     version: MODULE_VERSION,
   });
diff --git a/js/tsconfig.json b/js/tsconfig.json
index 71bc63b..03397b3 100644
--- a/js/tsconfig.json
+++ b/js/tsconfig.json
@@ -3,7 +3,7 @@
     "declaration": true,
     "esModuleInterop":true,
     "lib": ["es2015", "dom"],
-    "module": "commonjs",
+    "module": "esnext",
     "moduleResolution": "node",
     "noUnusedLocals": true,
     "outDir": "./lib",
@@ -13,11 +13,11 @@
     "sourceMap": true,
     "strict": true,
     "strictPropertyInitialization": false,
-    "target": "ES6",
+    "target": "es2015",
     "types": ["jest", "node"]
   },
   "include": [
     "src/**/*.ts",
     "src/**/*.tsx",
   ]
-}
\ No newline at end of file
+}

Sort on col header click

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

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.