I am scraping some data from a website. I have names
, and prices
lists from different pages. I want to stack two lists first, then an array contains all data in rows for each page. However, np.insert gives the following error:
'ValueError: could not convert string to float'.
Here is the code
import numpy as np
finallist = []
...
for c in range(0, 10)
narr = np.array(names)
parr = np.array(prices)
nparr = np.array(np.column_stack((narr, parr)))
finallist = np.insert(finallist, c, nparr)
What I want to accomplish is the following.
finallist = [[[name1, price1], [name2, price3], ...] # from page one
[name1, price1], [name2, price3], ...] # from page two
... ] # from page x
So that I will be able reach all data.