[英]Multiply Two different columns from two different Dataframes with specific condition
I have two different dataframes .我有两个不同的数据框。 They have the same columns but different rows.
它们具有相同的列但不同的行。 I need to multiply row from 2020 to 2023 of X DataFrame with percent Y DataFrame.
我需要将 X DataFrame 的 2020 到 2023 行与 Y DataFrame 的百分比相乘。
X DataFrame 2020: 300 multiply 0.2 and 40 multiply 0.4. X DataFrame 2020:300 乘以 0.2,40 乘以 0.4。
I will apply to like too many columns that is why I need to automate it.我将申请喜欢太多的专栏,这就是为什么我需要自动化它。 Would you please help me to figure out?
你能帮我弄清楚吗?
X.loc[2020:2023] = X.loc[2020:2023] * Y.loc['percent']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.