0

I have multiple dataframes which I join based on a common column. The code looks like this:

df=reduce(lambda x,y:pd.merge(x,y,on='name'),[total,eliminated, actionable, bug])

Afterwards, I intend to rename the column name. But name is not anymore in the column list. When I print the df, the name column shows but I don't know how to work with that merged column anymore, like renaming.

If I print type(df), df.columns, df, it shows:

(pandas.core.frame.DataFrame,
 Index(['total', 'e', 'a', 'b'], dtype='object'),
                        total      e      a      b
 name                                             
 !CHAOS Control System    282  80.14  39.01   1.42
 Chromium EC              306  93.46  29.74  17.65
 Firefox                 5448  77.22  49.72  12.43

What happended to the name column and how can I rename it afterwards?

Nasif Imtiaz Ohi
  • 1,563
  • 5
  • 24
  • 45

1 Answers1

1

It looks like you set 'name' as the index. Try this:

df = df.reset_index()
kait
  • 1,327
  • 9
  • 13