Summary:
- Try the live demo hosted on Dash Enterprise.
- The library is open-source and hosted in GitHub repository. Contributions are welcome!
- The package is index on PyPi. Try it now with
pip install dash-pivottable
- Interested in supporting the development of the library or sponsor a new feature? Learn more about our consulting services.
- Support for R was added in v0.0.2. See release announcement.
Introduction
Iâm happy to announce the initial release of Dash Pivottable (v0.0.1). Dash Pivottable is Dash component that wraps react-pivottable, a library created by @nicolaskruchten. You can find an example here, which will look like this:
The library has gained traction with the Dash Community after it was published as a Show & Tell, so we felt it was the right time to publish it as a library.
Dash Pivottable is already a complete and self-contained component for manipulating tabular datasets, but the project itself is the perfect example of how the Dash community can create their own components. It was created using the component boilerplate and written in less than 100 lines of React code (if we donât count prop typing), since it is wrapping an existing React library. This makes it easy to modify (if you want to create a custom pivottable component), or serve as a template for building a completely different component.
Quickstart
All you need to do to get started is to install the package from PyPi:
pip install dash-pivottable
and create an app in the following way:
import dash
import dash_html_components as html
import dash_pivottable
app = dash.Dash(__name__)
server = app.server
app.layout = html.Div(
dash_pivottable.PivotTable(
data=[
['Animal', 'Count', 'Location'],
['Zebra', 5, 'SF Zoo'],
['Tiger', 3, 'SF Zoo'],
['Zebra', 2, 'LA Zoo'],
['Tiger', 4, 'LA Zoo'],
],
cols=["Animal"],
rows=["Location"],
vals=["Count"]
)
)
if __name__ == "__main__":
app.run_server(debug=True)
And you will get the following pivot table:
Dash for R and CRAN
The release v0.0.2 includes support for R, and it will soon be contributed to CRAN. You will be able to find the download instructions in the README.md.
Changelog
In PR #21, I updated and improved the code, so that we would have automated testing, templates, and more. Below is a summary of the changes:
Added
- Up-to-date Contributing instructions
- Up-to-date Readme
- Issue and PR templates
- Dash testing with Pytest fixtures
- CircleCI deployment and Percy Snapshots
- Create package-lock.json instead of yarn.lock
- Up-to-date license
- Up-to-date
setup.py