This function is not working df.sort_index(ascending=False) in my code.
All my codes:
df = pd.read_csv('qwe2.csv', parse_dates=['date'], dayfirst=True)
# index sıralaması yap
df.sort_index(ascending=False)
# Seperatörleri değiştir
df.now=df.now.str.replace(",",".")
df.open=df.open.str.replace(",",".")
df.high=df.high.str.replace(",",".")
df.low=df.low.str.replace(",",".")
df.volume=df.volume.str.replace(",",".")
df.fark=df.fark.str.replace(",",".")
# Tarih formatını değiştir
df['date'] = df['date'].dt.strftime('%m/%d/%Y')
# M simgesini kaldır ve 1.000.000 ile çarp
for i in df['volume']:
i_temp = i
if str(i).endswith('K'):
i = float(str(i)[:-1]) * 1000
df['volume'].loc[df['volume'].values == i_temp] = i
elif str(i).endswith('M'):
i= float(str(i)[:-1]) * 1000000
df['volume'].loc[df['volume'].values == i_temp] = i
df.to_csv('qwe2.csv', index=False)
print(df)
All codes work without problems. But the index is not sorted from largest to smallest. Where could the error be?
Thanks