Removing index column in pandas

Removing index column in pandas

Asked on December 21, 2018 in Pandas.
Add Comment


  • 2 Answer(s)

    The index are always present in DataFrames and Series. The code del df[‘index’] will not work since the displayed columns are not actually columns.

    Use the function df.reset_index() for the sequential numbers to be replaced for index.For further information, refer index.

    Answered on December 21, 2018.
    Add Comment

    Use the below one line code for best result:

    df.reset_index(drop=True, inplace=True)
    
    
    Answered on December 21, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.