Pandas Removing index column

When I import a excel as a data frame in pandas and try to get rid of the first column I'm unable to do it even though i give index=None. What am I missing?

1 answer

  • answered 2018-07-11 03:58 David Gaertner

    I ran into this, too. You can make the friend column the index instead. That gets rid of the original index that comes with pd.read_excel(). As @ALollz says, a dataframe always has an index. You get to choose what's in it.

    data.set_index('friend', inplace=True)

    See examples in the documentation on DataFrame.set_index().