С учетом следующего набора данных:
from pandas import DataFrame
Data = {
'a1': [,0,,0.01,0,0.03,0.01,0.01,,0,0,0,0.01,0.01,0,0.01,0,0.01,0.01,0.01,0,,,,0,0,0.01,0.01,0.02,0.03,0],
'a2': [,,,,,,,,,,,,,,,,,,,,,,,0,0,,,0,,,],
'a3': [,0,0.02,,,0,0.01,0.03,0,0.01,0.01,0.02,,,,,,,,0.01,0.01,0,0.01,0.02,0,0,0.02,0,0,0,0.05],
'a4': [,0,0,,0,0,,0,,,,,,0,0,0,,0,0,0,0,0,0,0,0,,,,,,],
'a5': [,0,0,0,0,,0,,,,0,,,,,,,,,,,,,,,,,,,,],
'a6': [,0.01,0,0,0.01,0.01,0,0.01,0,0.01,0.01,0,0.01,0.01,0,0.01,0.01,0,0,0,0.01,0.01,0.03,0.01,0.01,0.01,0,0.01,0,0.01,0],
}
Как создать корреляционную матрицу, используя pandas и учитывая, что в массиве есть пустые / пустые значения для некоторых измерений? (это следует игнорировать)
Я попытался уменьшить minPeriods до 0.
df = DataFrame(Data,columns=['a1','a2','a3','a4','a5','a6'])
corrMatrix = df.corr(min_periods=0)
print (corrMatrix)