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 value produce an invalid document

See original GitHub issue

Writing a NaN produce an error while opening the document.

image

To reproduce

xlsxPopulate.fromBlankAsync()
  .then(workbook => {
    const sheet = workbook.activeSheet().name('test');

    sheet.cell(1, 1)
        .style('numberFormat', '0.00')
        .value(NaN);

    return workbook.outputAsync().then(blob => {
      if (window.navigator && window.navigator.msSaveOrOpenBlob) {
        window.navigator.msSaveOrOpenBlob(blob, 'out.xlsx');
      } else {
        const url = window.URL.createObjectURL(blob);
        const a = document.createElement('a');
        document.body.appendChild(a);
        a.href = url;
        a.download = 'out.xlsx';
        a.click();
        window.URL.revokeObjectURL(url);
        document.body.removeChild(a);
      }
    });

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mbrevdacommented, Jul 25, 2019

Just came across this, too. In this case, it would seem that writing nothing would be preferable, as that’s what was there before xml-populate parsed the file:

Screen Shot 2019-07-25 at 2 42 01 PM
1reaction
dtjohnsoncommented, Mar 1, 2019

I don’t like the idea of writing a “NaN” string. Setting to #NUM? or throwing an exception are the only options that make sense to me. I’m open to arguments for one or the other…

Read more comments on GitHub >

github_iconTop Results From Across the Web

TfidfVectorizer in scikit-learn : ValueError: np.nan is an invalid ...
I'm using TfidfVectorizer from scikit-learn to do some feature extraction from text data. I have a CSV file with a Score (can be...
Read more >
NaN - JavaScript - MDN Web Docs
The global NaN property is a value representing Not-A-Number. ... where an invalid value is to be represented as a number (e.g. an...
Read more >
pandas give a warning when working with np.NaN values #9950
NaN values, I get the following warning. Example: >>> import pandas ... RuntimeWarning: invalid value encountered in absolute abs_vals = np.abs(self.values) ...
Read more >
How to Deal With NaN Values - Datatest
Dropping NaNs Before Validation¶ ... Sometimes it's OK to ignore NaN values entirely. If this is appropriate in your circumstance, you can simply...
Read more >
is.nan Function, Count, Replace & Remove - Statistics Globe
How to handle NaN values in R - Example syntax - is.nan & is not nan ... However, if we try to run...
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