I tried going over How to build and fill pandas dataframe from for loop? but cant seem to write my values to my columns.
Ultimately I am getting data from a webpage and want to put it into a dataframe.
my headers are predefined as:
d1 = pd.DataFrame(columns=['col1', 'col2', 'col3', 'col4', 'col5', 'col6', 'col7', 'col8', 'col9',
'col10', 'col11', 'col12', 'col13', 'col14', 'col15', 'col16', 'col17'])
now I have values I get in a for loop, how can I write these rows to each column then repeat back to column 1 to 17 and then next row?
row = soup.find_all('td', attrs = {'class': 'Table__TD'})
for data in row:
print(data.get_text())
sample output row 1
Mon 11/11
SA
100
31
3-5
60.0
1-3
33.3
1-2
50.0
10
4
0
1
1
2
8
Sample output row 2
Wed 11/13
@CHA
W119-117
32
1-5
20.0
1-5
20.0
0-0
0.0
3
1
0
1
3
3
3
Expected output
Any help would be appreciated.