I got this problem while computing the pearson correlation of two datasets where one set consists of the same value. For example this pandas DataFrame:
tdf = pd.DataFrame([[1, 2], [1, 2], [1, 2]], columns=["a", "b"]) tdf.corr()
As a results from pandas correlation function I just geht 'NaN' values. I guess it is because the nominator and denominator from pearson formula are zero. But shouldn't the correlation value should be '1'? Do I missunderstand something?