I want to convert the list values into the Python Dataframe but my header values are inside the list.
the values which are inside the list are like this:
cols_head=['BATSMEN', '', 'R', 'B', '4s', '6s', 'SR', '', 'C Hemraj', 'c Mohammad Mithun b Mehidy Hasan Miraz', '9', '17', '2', '0', '52.94', '']
I have scraped the values from the espn website and it is score card now when the values are inside the list i want to convert them into the pandas dataframe. When I have convert the list into the dataframe I am getting the like this:
0
0 BATSMEN
1 Out
2 R
3 B
4 4s
5 6s
6 SR
7
8 C Hemraj
9 c Mohammad Mithun b Mehidy Hasan Miraz
10 9
11 17
12 2
13 0
14 52.94
from serial 0 to 7 these are columns of the dataframe
This is the code which I have tried to convert the values:
cols_head=[x.text.strip() for x in cell]
#print(cols_head)
List_values=cols_head[:-13]
df=pd.DataFrame(List_values)
I want to the output of the dataframe like this:
BATSMEN Out R B 4s 6s SR
1 C Hemraj C Mohammad Mithun 9 17 2 0 52.94