pythonpandasdataframequandl

Can't truncate pandas dataframe from quandl


Enter image description here

All my data is being pulled from quandl into pandas dataframes. For whatever reason when I call the dataframe function truncate, it seems to have no effect.

oil = pd.DataFrame(qd.get('OPEC/ORB'))
plat= pd.DataFrame(qd.get('LPPM/PLAT', column_index='1'))
pall = pd.DataFrame(qd.get('LPPM/PALL', column_index='1'))


pall.truncate(before='2003-01-02')


print(pall.head())

Solution

  • You need to assign the result of the truncation to the variable:

    pall = pall.truncate(before='2003-01-02')
    

    Otherwise, the operation is not persisted.