Skip to content Skip to sidebar Skip to footer

Using Pandas, Why Is The Column/series Header Not Showing At The Top Of An Output

In: def answer_three(): Top15 = answer_one() #https://stackoverflow.com/questions/51826751/average-of-dataframe-columns Top15['avgGDP'] = Top15[['2006', '2007

Solution 1:

A Series name is always shown under the Series. A DataFrame column name is shown above the column. You can convert the Series into a one-column DataFrame:

pd.DataFrame(Top15['avgGDP'])

It will be displayed as you expect.

Post a Comment for "Using Pandas, Why Is The Column/series Header Not Showing At The Top Of An Output"