Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df = pd.read_html('https://www.nfl.com/standings/league/2022/REG')
- df[0].to_excel('output.xlsx', index=False)
- # or
- df_first = pd.read_html('https://www.nfl.com/standings/league/2022/REG')[0]
- # or
- table_headers = table.findAll('th')
- new_columns = [th.text for th in table_headers]
- df = pd.DataFrame(columns = new_columns)
- table_rows = table.findAll('tr')[1:]
- for i in table_rows:
- row_data = i.findAll('td')
- row = [cell.text for cell in row_data]
- length = len(df)
- df.loc[length] = row
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement