As far as I can tell, Pandas uses the index to control itterows and will therefore go back to the normal order, even if you've resorted the dataframe, because the index goes with the row.
I've been able to iterate over the df in the intended order by resetting the index:
#%%
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame(
[
{"TICKER_id": "DXJ", "val": -0.5},
{"TICKER_id": "EWA", "val": 1.0},
{"TICKER_id": "EWC", "val": 0.0},
{"TICKER_id": "EWG", "val": -1.0},
{"TICKER_id": "EWI", "val": -0.5},
{"TICKER_id": "EWP", "val": -0.5},
{"TICKER_id": "EWQ", "val": 0.5},
{"TICKER_id": "EWU", "val": 0.0},
{"TICKER_id": "EWW", "val": -0.5},
{"TICKER_id": "EWY", "val": -1.0},
{"TICKER_id": "EWZ", "val": 0.5},
{"TICKER_id": "EZA", "val": 0.5},
{"TICKER_id": "FEZ", "val": -0.5},
{"TICKER_id": "INDA", "val": 0.0},
{"TICKER_id": "MCHI", "val": -0.5},
{"TICKER_id": "RSX", "val": 0.5},
{"TICKER_id": "SPY", "val": 0.0},
{"TICKER_id": "TUR", "val": -0.5},
]
)
df.plot() # 1
#%%
df.sort_values(by="val", ascending=False, inplace=True)
df.reset_index(drop=True, inplace=True)
df.plot() # 2
#%%
for index, row in df.iterrows():
if len(row.TICKER_id) == 3:
plt.scatter(index,row.val, c="r")
else:
plt.scatter(index,row.val, c="b") # 3
This gives:
1.
2.
3. 
This question is related to this.
list, you have some pandas data structure, in which case, you should use thesort_valuesmethodpandas, so i'm pretty sure it isn't a list. if you want to sort a list, you just use thesortedfunction. or the.sortmethod on a list, which will sort in-place