Search code examples
pythonpandasdataframedrop

Remove top row from a dataframe


I have a dataframe that looks like this:

         level_0              level_1 Repo Averages for 27 Jul 2018
0  Business Date           Instrument                           Ccy
1     27/07/2018  GC_AUSTRIA_SUB_10YR                           EUR
2     27/07/2018    R_RAGB_1.15_10/18                           EUR
3     27/07/2018    R_RAGB_4.35_03/19                           EUR
4     27/07/2018    R_RAGB_1.95_06/19                           EUR

I am trying to get rid of the top row and only keep

   Business Date           Instrument         Ccy
0     27/07/2018  GC_AUSTRIA_SUB_10YR         EUR
1     27/07/2018    R_RAGB_1.15_10/18         EUR
2     27/07/2018    R_RAGB_4.35_03/19         EUR
3     27/07/2018    R_RAGB_1.95_06/19         EUR

I tried df.columns.droplevel(0) but not successful any help is more than welcome


Solution

  • You can try using slicing.

    df = df[1:]

    This will remove the first row of your dataframe.