Search code examples
pandasdataframemachine-learningdata-analysis

Issue with Pandas DataFrame creating


I created a successful df, however, there's something wrong with the column names. they are not on the same row.

Anyone can give some advices? Appreciate it.

enter image description here


Solution

  • The first "Column" isn't a column. It's an index.

    pandas wants to differentiate between the name of the index "Industry" and the name of the columns "YTD_change". So it put's them on different lines. It's purely formatting.

    Try:

    df.reset_index()