简体   繁体   中英

How do I divide one column in one df by another column in a different df in pandas?

Here's my例子

If I have two dataframes (say df4avg and df5avg) with identical corrected wavelengths and different count rates, and I want to divide the df4avg count rate by df5avg's count rate and get an output of the corrected wavelength and the new divided value with a new column name (say 'ratio'), how would I do this?

If you want to add the ratio column in the df4avg Dataframe then

df4avg['ratio'] = df4avg['COUNT_RATE'] / df5avg['COUNT_RATE']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM