I have a pyspark dataframe as below. I want to obtain values in index column with pyspark functionalities.
| Period | cp1 | cp2 | index |
|---|---|---|---|
| 2022-12-31 | 70.07 | 22.1 | |
| 2021-09-19 | 70.38 | Null | |
| 1992-01-03 | 80.7 | Null | |
| 1975-02-05 | 55.23 | Null | |
| 2000-08-08 | 22.2 | Null |
index = every value in cp1 column/with only value in cp2 i.e 22.10
Can someone help me out with this ?