Similarity measure for multivariate time series with heterogeous length and content I am interested in clustering multivariate N time series of T'values' each(different lengths) using python. Each variable have many trends and values which are simultaneously numeric and nominal.

A sample $T_{i}$ in the dataset has the following format:

TimeStamp       | Sensor0 | Sensor1| Sensor2
2015-02-05 11:30|&lt;Min     | On     | off
2015-02-05 11:31|&lt;Min     | on     | off 
2015-02-05 11:32| Action2 | 10     | 0.0001  
2015-02-07 11:33| Action2 | 10     | 0.00012 
2015-02-07 11:34| Action2 | 10     | 0.00012 
2015-02-07 11:35| Action2 | 20     | 0.00015 


Another sample $T_{j}$ in the dataset has the following format:

TimeStamp       | Sensor0 | Sensor1| Sensor2
2015-10-05 11:30| Action2 | 11     | off
2015-10-05 11:31| Action1 | 11     | off 
2015-10-05 11:32| Action2 | NAN    | 0.0001  
2015-10-07 11:33| Action3 | NAN    | 0.00012 
2015-10-07 11:34| &lt;Min    | 10     | 0.00012 
2015-10-07 11:35| &lt;Min    | 15     | on 


For the missing values (not numeric), they were not collected by the sensors so my idea was to replace them by minimum values., given that all values are strictly positive.
Otherwise, they would be considered as missing values. In which case the problem would be of finding a similiraty measure that can compare missing values (off,on..) and numeric values.

I am wondering if there is a similarity / distance measure already exist in the litterature to compare such multivariate timeseries, with hetergonuos lengths, and whether this kind of problem has already been formulated in the papers, books or else for R and python.

Thanks for your advice.
Try this recent paper: Consistent Algorithms for Clustering Time Series.

Your question is very much a current research topic.

Here's an older but excellent paper which talks about the fundamentals: Generalized Feature Extraction for Structural Pattern Recognition in Time-series Data.