I have a Dataframe as shown:
I have to normalise the Close column of dataframe as follows:
For Each symbol we have to divide the close price on succeeding days by the First close price. This means the normalised closed for APLAPOLLO on 24/11/2020 will be calculated as:
Normalised_Close_price=(Close on 24/11/2020)/(Close on 23/11/2020)=0.9915( Valid Only For Aplapollo)
Now if the symbol changes the method remains same only the values in the above formulae changes. Hence For AUBANK the normalised closed on 24/11/2020 will be calculated as:
Normalised_Close_price=(Close on 24/11/2020)/(Close on 23/11/2020)=0.9915( Valid Only for AUBANK)
The normalised close for other symbol should be calculated in the same way.
Hence after the calculation the dataframe should look as shown:
eg: For Aplapollo from above explanation:
- normalise value for 24/11/2020=(3219.95/3247.45)=0.991532
- normalise value for 25/11/2020=(Close on 25/11/2020)/(Close on 23/11/2020)=0.991686
- normalise value for 26/11/2020=(Close on 26/11/2020)/(Close on 23/11/2020)=0.978907
Similarly for other symbols
I have referred to the following answer on normalising dataframe columns:
Normalize columns of pandas data frame
This does not help as the values are changing as per the condition in my case