Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Conversation

@Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Feb 15, 2019

This has been released!

pip install dash-table==3.6.0

See the documentation in the new Data Types Chapter of the Dash DataTable User Guide.


(Original PR below)

This is a work in progress and not quite ready for review 😄

Fixes #189

  • general formatting of numbers through d3-format
  • locale format
  • si prefix
  • four digits grouping case
    separate_4digits nested prop under locale will prevent grouping on values ]-10000,+10000[
  • python helper methods
  • proper documentation of the new props / nested props
  • proper documentation / IDE integration (?) or discoverability of Python helpers
  • push BI logic (column format defaults, etc.) higher in the stack (ideally in/around datatable.js)
    BI logic here means (1) data validation and (2) data sanitizing -- more data sanitizing/validation can be added in the future, for now concerning itself with columns (new) & pagination/filtering/sorting (refactored)
  • general / sanity unit testing of the formatter functionality
  • integration testing of formatting / table content
  • testing for Python wrappers
  • changelog entry
  • basic performance verifications
  • toPlotlyJson for Format objects
  • rename Python-facing currency to symbol
  • sibling PR for dash-docs (https://github.com/plotly/dash-docs/pull/416)

Edge cases identified while writing tests or documentation

  • handling of coerce/validation/passthrough/isNully cases during formatting -- a number column may very well not contain a number, how to configure and handle these cases from a formatting perspective?
    Approach: overridable nully behavior, non-number types are passthroughs
  • Clipboard copy/paste behavior is ok when data comes from outside but does not deal well with null/undefined cases as everything gets transformed to a string ('' in those cases) and information is lost
    Approach Keep a duplicate of the df slice copied -- if during paste the df slice's stringification is the same as the clipboard content, assume that the data came from a datatable.
  • determine desired nully case behavior (currently '' (empty string)

Note: Diff settings -> Hide whitespace helps with a few of the diffs that involve indentation changes..

- add formatter resolution code
- use formatter in cell label
- add formatting prop
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 15, 2019 21:22 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 15, 2019 22:55 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 18, 2019 15:30 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 18, 2019 17:38 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 18, 2019 18:03 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 18, 2019 19:01 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 18, 2019 19:27 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 18, 2019 19:35 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 18, 2019 21:19 Inactive
- add si prefix support
- update js props and code to support si prefix
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 19, 2019 16:11 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 20, 2019 18:45 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 20, 2019 19:28 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 20, 2019 20:19 Inactive
UPPER_CASE_HEX = 'X'
UNICODE = 'c'

class Format():
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A fuent interface to create the desired format/locale/prefix configuration

self.specifier['precision'],
self.specifier['trim'].value,
self.specifier['type'].value
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns the actual format configuration object corresponding to all previous operations

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 27, 2019 16:15 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 27, 2019 16:19 Inactive
Marc-André Rivet added 2 commits February 27, 2019 11:20
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 27, 2019 16:20 Inactive
@Marc-Andre-Rivet Marc-Andre-Rivet changed the title [WIP] Issue 189 - Number formatting Issue 189 - Number formatting Feb 27, 2019
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 27, 2019 17:30 Inactive
@alexcjohnson
Copy link
Collaborator

determine desired nully case behavior (currently '' (empty string)

@chriddyp do you have an opinion about the default nully behavior? I like the empty string (as currently in this PR) but could be convinced to default to 'NA' or something instead.

Marc-André Rivet added 2 commits February 28, 2019 08:27
- exception type
- datatable location / file rename
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 28, 2019 13:27 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 28, 2019 13:32 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 28, 2019 14:18 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-377 February 28, 2019 14:31 Inactive
Copy link
Collaborator

@alexcjohnson alexcjohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another huge feature set! 💃

@Marc-Andre-Rivet Marc-Andre-Rivet merged commit 18c185f into master Feb 28, 2019
@Marc-Andre-Rivet Marc-Andre-Rivet deleted the issue189-number-formatting branch February 28, 2019 15:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

data types - decimal formatting options for numerical columns

4 participants