nteract/papermill

NaN in output JSON

Offen

#630 geöffnet am 16.09.2021

 (2 Kommentare) (1 Reaktion) (0 zugewiesene Personen)Python (402 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (5.381 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

🐛 Bug

When passing nan as a parameter for a notebook, even a simple one with only one cell with

print(parameter)

we get an output notebook with:

"metadata": {
  ...,
  "papermill": {
   "default_parameters": {},
   "duration": 1.086503,
   "end_time": "2021-09-16T08:05:29.914692",
   "environment_variables": {},
   "exception": null,
   "input_path": "test.ipynb",
   "output_path": "output.ipynb",
   "parameters": {
    "parameter": NaN
   },
  ...,
  }
 },

The problem is that NaN is not a valid JSON keyword, so when I try to open the .ipynb with Jupyter or any other notebooks interpreter, I get: Unable to open 'output.ipynb': Unexpected token N in JSON at position 2215.

Contributor Guide