[英]How do I divide one column in one df by another column in a different df in pandas?
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?如果我有两个具有相同校正波长和不同计数率的数据帧(例如 df4avg 和 df5avg),并且我想将 df4avg 计数率除以 df5avg 的计数率并得到校正波长的 output 和带有新列的新除值名称(说“比率”),我该怎么做?
If you want to add the ratio
column in the df4avg
Dataframe then如果要在
df4avg
Dataframe 中添加ratio
列,则
df4avg['ratio'] = df4avg['COUNT_RATE'] / df5avg['COUNT_RATE']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.