What is the fastest way to turn
df[["Strat1", "Close"]]
Strat1 Close
0 Sell 14185.250000
1 Sell 14185.150391
2 Sell 14157.320312
3 Sell 14184.709961
4 Sell 14185.139648
5 Buy 14171.000000
6 Buy 14166.919922
7 Buy 14150.009766
8 Buy 14136.209961
9 Sell 14131.889648
10 Sell 14129.969727
11 Buy 14135.500000
12 Buy 14135.500000
13 Buy 14135.500000
14 Sell 14135.500000
15 Buy 14135.500000
Into
df[["Strat1", "Close"]]
Strat1 Close
0 Sell 14185.250000
1 14185.150391
2 14157.320312
3 14184.709961
4 14185.139648
5 Buy 14171.000000
6 14166.919922
7 14150.009766
8 14136.209961
9 Sell 14131.889648
10 14129.969727
11 Buy 14135.500000
12 14135.500000
13 14135.500000
14 Sell 14135.500000
15 Buy 14135.500000
Do you have to iterate through the DataFrame line by line? My dataframe has 1.4 million rows of data so iterating line by line will inevitably take a while, also I have lots of columns "Strat2", "Strat3" that I want to test, further increasing the length of time taken to fix this problem.