question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`NaN`s and `infinity`s are displaying as null

See original GitHub issue

Context

NaNs and ±Infinitys (possible float values in PostgreSQL) are displayed as null values, leading to problems with summaries (e.g., max(column) will strangely say null is the largest value of a dataset). Even further, they cause the widgets to break.

Steps to Reproduce

  1. Import a dataset (which is a CSV but GitHub won’t let me do CSVs) with NaNs and Infinitys: inf-nan-values.txt
  2. Change the column type of column val to ‘number’ in the Builder
  3. Observe that the val column has values 1.2, null, and null.
  4. Run this query to see if those values are actually null-valued: SELECT val is null FROM inf_nan_values
  5. Observe that the results are all false, indicating that the values are not null valued.
  6. Casting val to text produces infinity and NaN.
  7. Calculate the max of the dataset produces null, but casting to text gives NaN again.
  8. Create a widget on the column val and observe that the widget does not work. screen shot 2017-05-18 at 08 30 32

Current Result

Infinity and NaN are shown as Null when they are actually not and produces different information when used in calculations. These values break the widgets.

Expected result

The values of infinity and NaN are displayed in the builder what they really are to avoid confusion. These values should also not break the widgets, but the user should be able to remove these values easily so that the widgets can work as expected. For example, a broken widget could say ‘Cannot make widget because column has values of Infinity’.

Browser and version

Chrome 58.0.3029.110 (64-bit), macOS 10.12.4

.carto file

None, but this ‘csv’: inf-nan-values.txt

Additional info

Information can be displayed to communicate that there are NaNs and Infinitys in the dataset, and that they are removed when constructing the widgets. NumPy has very good behavior for dealing with these two values.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
jgoizuetacommented, Jun 23, 2017

Acceptance plan:

  • Install the branches of SQL-API & Windshaft Cartodb in a staging dedicated server
  • Prepare a datasets containing FLOAT & FLOAT8 columns with Infinities & NANs and another NUMERIC columns with some NANs. Duplicate the dataset and create overviews for the copy witth CDB_CreateOverviews (the dataset well need enough rows for the overviews to be populated)
  • Create a map with Builder and try all widget types on both tables with the three numerical columns; check widgets run without errors and results are correct (infinities ignored for min/max ranges, etc.)
0reactions
jgoizuetacommented, Jun 27, 2017

I’m moving this to deploy, since the acceptance tests are successful regarding the fixes done here to SQL-API and WIndshaft-Cartodb and having this in production is a big improvement over the current situation (where widgets break in the presence of NaNs, etc).

The issues revealed during acceptace affecting various CARTO components can be handled independently in separate tickets.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to handle null, infinity, and not-a-number values
This guide will show you how to handle null, infinity, and not-a-number (NaN) values in your datasets. Not all numeric types support each...
Read more >
Why do 'Infinity', 'null', 'NaN' and 'undefined' have inconsistent ...
null and undefined are is a JavaScript keywords, reflecting various "not a value" metawackery. All keywords I'm aware of are lowercase (c.f. ...
Read more >
INF, NAN, and NULL - Exception values - Analytica Wiki
INF ("infinity"), NAN ("not a number"), and Null are special-valued system constants that Analytica returns in particular conditions, such as exceptions.
Read more >
R null values: NULL, NA, NaN, Inf - R-bloggers
In general, R supports: NULL NA NaN Inf / -Inf NULL is an object and is ... Inf and -Inf stands for infinity...
Read more >
avoiding "NaN" , "infinity" in reports - MSDN - Microsoft
... I get "NaN" and "Infinity" values, I wanted to avoid this and display "0" if the result of calculation is null or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found