Skip to content
Advertisement

how do I loop through each row and save the result in same row but in difference column?

I have a created a code where input variable is URL and it returns price, title, video, newURL

For instance:

JavaScript

And now, instead of copy and paste url over and over. I have created a CSV file like below and would like URL at each row to go through a loop and

  1. create a data (price, title)
  2. and save price, title data to same row with corresponding URL

enter image description here

So, I tried by using while loop as below:

JavaScript

However, I keep getting an error. I think there should be a better way of reading and wiriting a data at NaN elements but does not have any clue..

Advertisement

Answer

you can create the output dataframe based on a nested list, like this:

JavaScript
Advertisement