Home > database >  Concat data frames : Adding a name to data frame column which does not have a name
Concat data frames : Adding a name to data frame column which does not have a name

Time:08-24

I am making a data frame by concatenating several data frames .The code is given below.

summary_FR =pd.concat([Chip_Cur_Summary_funct_mode2,Noise_Summary_funct_mode2,VCM_Summary_funct_mode2,Sens_Summary_funct_mode2,Vbias_Summary_funct_mode2,vcm_delta_Summary_funct_mode2,THD_FUN_M2,F_LOW_FUNC_Summary_mode2,OSC_FUNC_Summary_mode2,FOSC_FUNC_Summary_mode2,VREF_CP_FUNC_Summary_mode2,Summary_PSRR_1KHz_funct_mode2,Summary_PSRR_20Hzto20KHz_funct_mode2])

The image of the table is given below. You can see that the 1st column don't have any name.I need to set it name as Parameter and make it as unique index column.

I tried the below code to set the name as 'Parameter' and I failed.

summary_FR.columns = ["Parameters", "SPEC_MIN", "SPEC_TYP", "SPEC_MAX","min","mean","max","std","Units","Remarks"]
# summary_FR.set_index()

May I know where I went wrong.Can someone please help me.

enter image description here

CodePudding user response:

You can give a name for the index in the following way:

your_dataframe.index.name = 'Parameter'

CodePudding user response:

It helps to share the error message but that is probably an index column. You need to call reset_index on the concatenated dataframe like

summary_FR =pd.concat([Chip_Cur_,...,Summar]).reset_index()

then you can change the colun names.

  • Related