In python pandas , when I have a dataframe df like this
| c1 | c2 | c3 |
|---|---|---|
| 0.1 | 0.3 | 0.5 |
| 0.2 | 0.4 | 0.6 |
I can use df.corr() to calculate a correlation matrix .
How do I do that in spark with scala ?
I have read the official document , The data struct isn't like above . I don't know how to transfer it .
Update one:
val df = Seq(
(0.1, 0.3, 0.5,0.6,0.8,0.1, 0.3, 0.5,0.6,0.8),
(0.2, 0.4, 0.6,0.7,0.7,0.2, 0.4, 0.6,0.7,0.7),
).toDF("c1", "c2", "c3","c4","c5","c6", "c7", "c8","c9","c10")
val assembler = new VectorAssembler().setInputCols(Array("c1", "c2", "c3","c4","c5","c6", "c7", "c8","c9","c10")).setOutputCol("vectors")
How to show the whole result when the number of column is 10 ?