Consider the following data frames in Python Pandas:
DataframeA
| ColA | ColB | ColC |
|---|---|---|
| 1 | dog | 439 |
| 1 | cat | 932 |
| 1 | frog | 932 |
| 2 | dog | 2122 |
| 2 | cat | 454 |
| 2 | frog | 773 |
| 3 | dog | 9223 |
| 3 | cat | 3012 |
| 3 | frog | 898 |
DataframeB
| ColD | ColE |
|---|---|
| 1 | 101 |
| 2 | 314 |
| 3 | 124 |
To note, ColB just repeats it's string values as ColA iterates upwards. ColC and ColE are random. ColA and ColD correspond. ColD values will never have repeats (like a map).
I want to divide ColC by ColE wherever ColA == ColD and ideally put the resulting value in a new column in DataframeA (or just have it overwrite ColC). The resulting value should be able to have decimals.
How can I do this in Python Pandas?