I have two excel files with the same items organized according to two different measures of frequency. I've converted the files into data frames using Jupyter Notebook, and I would like to combine them into a single data frame according to the model in the picture. Is there a way to do this with pandas? Thanks! model for desired output image
df
anddf1
, you can usedf.add(df1)
, see the documentation here.df.add(df1).sort_values(ascending=False)
). However, if you don't want to set these to the index, such asdf.set_index(authors).add(df1.set_index(authors))
, you can instead usepd.merge
orpd.concat
to combine the two dataframes to one, then sum the two columns.