Card rendering breaks for tables with some NaN values
Author: maxfriedrichCreated Apr 26, 2022Updated Sep 17, 2026
Hi Metaflow team!
When storing a DataFrame artifact that has a column with some actual numbers and some NaN values, the step's default card fails to render completely. Just the Metaflow logo is shown, the rest of the page is empty, console shows "TypeError: Load failed".
When a column has only NaN values, rendering succeeds and shows "null" in these columns in the table.
Here is an example to reproduce the bug:
no_card_test.py:
from metaflow import FlowSpec, step, card
class NoCardTest(FlowSpec):
@card
@step
def start(self):
import pandas as pd
# rendering fails if a column has mixed actual values and NaN:
self.result = pd.DataFrame([[1, 2], [3, None]])
# rendering works if the second column has only NaN values:
# self.result = pd.DataFrame([[1, None], [3, None]])
self.next(self.end)
@step
def end(self):
print("Finished!")
if __name__ == "__main__":
NoCardTest()I'm running this command:
python no_card_test.py run && python no_card_test.py card view startI'm running Metaflow 2.6.0 on Python 3.8, all local in this example but I assume this is a problem in the cards JS code. I'd be happy to open a PR to fix this if you point me to the right place. Thank you!
Source: Netflix/metaflow