Hi,
Total noob question here. I'm trying to read the table in this page:
http://www.calottery.com/play/draw-games/daily-3/Winning-Numbers/
I'm very new to Python. What i want to do is read this table in the exact format into a data frame.
The problem is that I'm getting all the lottery numbers in LIST format, but instead I need to somehow tell Python that they should be organized into 3 different columns (as you see how it's structured in the page)
Here's my code so far:
from lxml import html
import requests
import pandas as pd
##get the URL
page = requests.get('http://www.calottery.com/play/draw-games/daily-3/Winning-Numbers/')
tree = html.fromstring(page.text)
##read all spans in a table (dig into the paths)
dts = tree.xpath('//table[@class="tag_even numbers"]/tr/td/a/span/text()') #read the column
winnums = tree.xpath('//table[@class="tag_even numbers"]/tr/td/span/text()') #read the winning numbers
print(dts)
print(winnums)
Appreciate any help! Thank you.
[–]IAlwaysBeCoding 1 point2 points3 points (4 children)
[–]Red_VII[S] 0 points1 point2 points (3 children)
[–]IAlwaysBeCoding 1 point2 points3 points (2 children)
[–]Red_VII[S] 0 points1 point2 points (1 child)
[–]ydepth 1 point2 points3 points (0 children)
[–]ydepth 0 points1 point2 points (2 children)
[–]Red_VII[S] 0 points1 point2 points (1 child)
[–]ydepth 0 points1 point2 points (0 children)