clean-school-46881
03/23/2023, 4:13 PMCard of type default is unable to be rendered with arguments None.
Stack trace : Traceback (most recent call last):
File ".../.venv/lib/python3.10/site-packages/metaflow/plugins/cards/card_cli.py", line 503, in create
rendered_info = render_card(mf_card, task, timeout_value=timeout)
File ".../.venv/lib/python3.10/site-packages/metaflow/plugins/cards/card_cli.py", line 384, in render_card
rendered_info = mf_card.render(task)
File ".../.venv/lib/python3.10/site-packages/metaflow/plugins/cards/card_modules/basic.py", line 605, in render
json.dumps(final_component_dict).encode("utf-8")
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Timestamp is not JSON serializableclean-school-46881
03/23/2023, 4:14 PMclean-school-46881
03/23/2023, 4:25 PMhallowed-glass-14538
03/23/2023, 5:51 PMclean-school-46881
03/23/2023, 6:04 PM<http://pd.to|pd.to>_datetime() with utc=True, resulting in a datetime64[ns, UTC] object. 🙂hallowed-glass-14538
03/23/2023, 6:38 PMclean-school-46881
03/29/2023, 5:55 PMhallowed-glass-14538
03/29/2023, 6:21 PMto_json ; Which seems reasonable but I think we made a decision to not do it since to_json doesn't preserve the index and the dataframe appearing on the UI can have completely different view from what the user intended. The main goal was to keep the "appearance" (layout) of the dataframe very similar to what the user would see in their notebook.
I think thats why we did all the complex logic in that _parse_pandas_dataframe function. There maybe an avenue where to_json works with some additional tweeks but didn't get the chance to explore that.
To solve this problem we can test if df.astype('object') can do a native conversion. If it can then it would make it much easier to parse the dataframe.hallowed-glass-14538
03/29/2023, 6:36 PMclean-school-46881
03/29/2023, 7:04 PMhandsome-ocean-79057
05/11/2023, 12:40 PMhandsome-ocean-79057
05/11/2023, 12:44 PMhallowed-glass-14538
05/11/2023, 4:28 PM