Repository: evidentlyai/evidently
Issue: Fail to generate the html drift report
Root cause: Validation Gap

Running the following command on python 3.7.7 on windows 10 in a virtualenv 
```
data_drift_report = Dashboard(training_data_raw_w1, training_data_raw_w3, column_mapping=column_mapping, tabs = [DriftTab])
data_drift_report.save("reports/data_drift.html")
```
Encountered this error
```
TypeError                                 Traceback (most recent call last)
<ipython-input-37-743b30a1199c> in <module>
----> 1 data_drift_report.save("reports/data_drift.html")

c:\users\yanhong.zhao\ef\nga-china-bidding-prototype\venv\lib\site-packages\evidently\dashboard\dashboard.py in save(self, filename)
    173             os.makedirs(parent_dir, exist_ok=True)
    174         f = open(filename, 'w')
--> 175         f.write(self.html())
    176         #f.write(self.__render(file_html_template))

c:\users\yanhong.zhao\ef\nga-china-bidding-prototype\venv\lib\site-packages\evidently\dashboard\dashboard.py in html(self)
    166 
    167     def html(self):
--> 168         return self.__render(file_html_template)
    169 
    170     def save(self, filename):

c:\users\yanhong.zhao\ef\nga-china-bidding-prototype\venv\lib\site-packages\evidently\dashboard\dashboard.py in __render(self, template)
    146             for graph in widget.additionalGraphs:
    147                 additional_graphs[graph.id] = graph.params
--> 148         return template(TemplateParams(dashboard_id, di, additional_graphs))
    149 
    150     def _json(self):

c:\users\yanhong.zhao\ef\nga-china-bidding-prototype\venv\lib\site-packages\evidently\dashboard\dashboard.py in file_html_template(params)
    105 </script>
    106 </body>
--> 107 """
    108 
    109 

c:\users\yanhong.zhao\ef\nga-china-bidding-prototype\venv\lib\site-packages\evidently\dashboard\dashboard.py in __dashboard_info_to_json(di)
     26 
     27 def __dashboard_info_to_json(di: DashboardInfo):
---> 28     return json.dumps(asdict(di))
     29 
     30 

~\.pyenv\pyenv-win\versions\3.7.7\lib\json\__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
    229         cls is None and indent is None and separators is None and
    230         default is None and not sort_keys and not kw):
--> 231         return _default_encoder.encode(obj)
    232     if cls is None:
    233         cls = JSONEncoder

~\.pyenv\pyenv-win\versions\3.7.7\lib\json\encoder.py in encode(self, o)
    197         # exceptions aren't as detailed.  The list call should be roughly
    198         # equivalent to the PySequence_Fast that ''.join() would do.
--> 199         chunks = self.iterencode(o, _one_shot=True)
    200         if not isinstance(chunks, (list, tuple)):
    201             chunks = list(chunks)

~\.pyenv\pyenv-win\versions\3.7.7\lib\json\encoder.py in iterencode(self, o, _one_shot)
    255                 self.key_separator, self.item_separator, self.sort_keys,
    256                 self.skipkeys, _one_shot)
--> 257         return _iterencode(o, 0)
    258 
    259 def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,

~\.pyenv\pyenv-win\versions\3.7.7\lib\json\encoder.py in default(self, o)
    177 
    178         """
--> 179         raise TypeError(f'Object of type {o.__class__.__name__} '
    180                         f'is not JSON serializable')
    181 

TypeError: Object of type float32 is not JSON serializable
```
Think it has something to do with the saving dashboard data into JSON @emeli-dral so I tested it out this way (the dashboard class is generated but it can't be saved)
```
from dataclasses import asdict
import uuid
from evidently.model.dashboard import DashboardInfo
dashboard_id = "evidently_dashboard_" + str(uuid.uuid4()).replace("-", "")
tab_widgets = [t.info() for t in data_drift_report.tabsData]
di = DashboardInfo(dashboard_id, [item for tab in tab_widgets for item in tab if item is not None])
```
and calling any of the objects in tab_widgets/di/asdict(di) crashes the jupyter notebook instance



ah fixed the issue just now. In windows the pandas dataframe columns have value types float64 and float32 as opposed to just Mac with float only. When you have nan values the colume type is defaulted to float32 so after you fillna in the dataframe you will need to explicitly change the colume types for json to work!

feel free to close this issue as this is more of a windows issue that one needs to deal with all data science projects when you want to dump something into json

one less ideal consequence of having a big dataset is that the html file I generated is 1G large

Hi,

Glad it was resolved quickly! 

Thanks for opening the issue. Even though it is solvable with a work-around, we will add to the list of bugs to address. 

Let us know if you need any further help or have any feedback on the tool.

this article might be helpful for the fix https://ellisvalentiner.com/post/serializing-numpyfloat32-json/