-1

I am importing a Data set from quandl using API. Everything is perfect, however the time series I am importing is reversed. By this I mean if I used the .head method to print the first elements in the data set, I will get the latest Data set figures and printing the tail will get oldest figures

df = pd.read_csv("https://www.quandl.com/api/v3/datasets/CHRIS/CME_CD4.csv?api_key=H32H8imfVNVm9fcEX6kB",parse_dates=['Date'],index_col='Date')

df.head()

D. Price
  • 40
  • 5
issam ozeir
  • 23
  • 1
  • 4

1 Answers1

0

This should be a pretty easy fix if I understand. Credit to behzad.nouri on this answer Right way to reverse pandas.DataFrame?.

You just need to reverse the order of your dataframe using the line below. df = df.reindex(index=df.index[::-1])

D. Price
  • 40
  • 5