Repository: mindsdb/lightwood

Issue:
Error when querying time-series model
The bellow error occurs when querying the timeseries model. @paxcema This is the issue we have talked about on the tech_tack channel. 

```
ERROR:mindsdb.api.http.initialize:Exception on /api/predictors/nyc_model/predict [POST]
Traceback (most recent call last):
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/flask_restx/api.py", line 375, in wrapper
    resp = resource(*args, **kwargs)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/flask_restx/resource.py", line 44, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb/api/http/namespaces/predictor.py", line 213, in post
    results = ca.mindsdb_native.predict(name, when_data=when, **kwargs)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb/interfaces/native/native.py", line 81, in predict
    **kwargs
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb_native/libs/controllers/predictor.py", line 438, in predict
    self.transaction.run()
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb_native/libs/controllers/transaction.py", line 327, in run
    self._call_phase_module(module_name='ModelInterface', mode='predict')
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb_native/libs/controllers/transaction.py", line 178, in _call_phase_module
    ret = module(self.session, self)(**kwargs)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb_native/libs/phases/base_module.py", line 53, in __call__
    ret = self.run(**kwargs)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb_native/libs/phases/model_interface/model_interface.py", line 21, in run
    self.transaction.hmd['predictions'] = self.transaction.model_backend.predict()
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/mindsdb_native/libs/phases/model_interface/lightwood_backend.py", line 537, in predict
    predictions = self.predictor.predict(when_data=run_df)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/lightwood/api/predictor.py", line 164, in predict
    return self._mixer.predict(when_data_ds, **kwargs)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/lightwood/mixers/base_mixer.py", line 58, in predict
    _, _ = when_data_source[0]
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/lightwood/api/data_source.py", line 219, in __getitem__
    self.get_encoded_column_data(col_name)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/lightwood/api/data_source.py", line 489, in get_encoded_column_data
    encoded_vals = self.encoders[column_name].encode(*args)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/lightwood/encoders/time_series/rnn.py", line 317, in encode
    encoded = self._encode_one(val, previous=[values[i] for values in ptd])
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/lightwood/encoders/time_series/rnn.py", line 221, in _encode_one
    data, lengths_data = self._prepare_raw_data(data)
  File "/home/zoran/MyProjects/mindsdb-examples/mysql/mdbn/lib/python3.7/site-packages/lightwood/encoders/time_series/rnn.py", line 101, in _prepare_raw_data
    t = torch.tensor(e, dtype=torch.float)
TypeError: must be real number, not NoneType
```


Discussion:

Resolving patch:
diff --git a/lightwood/__about__.py b/lightwood/__about__.py
--- a/lightwood/__about__.py
+++ b/lightwood/__about__.py
@@ -1,6 +1,6 @@
 __title__ = 'lightwood'
 __package_name__ = 'mindsdb'
-__version__ = '0.62.0'
+__version__ = '0.62.1'
 __description__ = "Lightwood's goal is to make it very simple for developers to use the power of artificial neural networks in their projects."
 __email__ = "jorge@mindsdb.com"
 __author__ = 'MindsDB Inc'
diff --git a/lightwood/encoders/time_series/rnn.py b/lightwood/encoders/time_series/rnn.py
--- a/lightwood/encoders/time_series/rnn.py
+++ b/lightwood/encoders/time_series/rnn.py
@@ -98,6 +98,8 @@ def _prepare_raw_data(self, data):
         out_data = []
         for e in data:
             if not isinstance(e, torch.Tensor):
+                e = np.array(e, dtype=float)
+                e[np.isnan(e)] = 0.0
                 t = torch.tensor(e, dtype=torch.float)
             else:
                 t = e.float()


Test patch: