0
for ind,row in new_table.iterrows():
    new_table.loc[ind,"ratio_kcal/kg"]= row["Food supply (kcal/capita/day)"] * row["Food supply quantity (kg/capita/yr)"]

being that: Food supply (kcal/capita/day) is a column to be multiplied by 365 and result to be divided by is Food supply quantity (kg/capita/yr), into a new resulting column -ratio_kcal/kg ,thank you for your reply, last solution didn't work but I think it is my fault because I wasn't detailed enough so...

enter image description here

thanks for info so far given, im just stuck at how to insert the resulting data into a new column. screen shot is where im stuck .. enter image description here

  • Welcome to Stack Overflow. Please read [ask] and the [formatting help](https://stackoverflow.com/help/formatting), and make sure that you clearly *ask a question*. What happened when you tried that code? How is the result different from what you expect? What setup do we need in order to test that code (for example, what is the value of `new_table` beforehand)? What specific question do you have about these results? What happened when you tried to solve the problem yourself? What [research](https://meta.stackoverflow.com/questions/261592/) did you do? – Karl Knechtel Nov 11 '21 at 08:50
  • 1
    Just do `new_table["ratio_kcal/kg"] = new_table["Food supply (kcal/capita/day)"] / 365 * new_table["Food supply quantity (kg/capita/yr)"]`, without any looping? – Timus Nov 11 '21 at 14:35
  • Please read [this](https://stackoverflow.com/help/how-to-ask) carefully. Then remove the images. And after that add a [mre](https://stackoverflow.com/help/minimal-reproducible-example) (also look [here](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples)) that replicates your problem (small). Otherwise you make it extremely hard to help you. – Timus Nov 12 '21 at 13:23

0 Answers0