Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[Python (Data Gathering)] Extract data from website and convert the data to csv file Hi, I am struggling in Python. I try to extract a

[Python (Data Gathering)] Extract data from website and convert the data to csv file

Hi, I am struggling in Python. I try to extract a data from website, structure the format and convert it to csv file.

The data I want to extract is from this website: Top 100 Movies of All Time - Rotten Tomatoes

This is what I am trying to achieve it.

image text in transcribed

I try but this is what I get

image text in transcribed

This is my code for those who are wondering, yeah it kinda short because I try many possible ways

import requests import pandas as pd import os from bs4 import BeautifulSoup from urllib.request import urlopen

url = f'https://www.rottentomatoes.com/top/bestofrt/' html = urlopen(url)

soup = BeautifulSoup(html, 'lxml')

table = soup.find("table",{"class":"table"})

print(table)

I would appreciate if someone could help me with the coding part!

D E F G o P R S C Age G GS MP 63 L M 3P% 2P 0 0 0.333 0 0.2 0.143 1.2 3 0.389 0 0 63 72 53 72 T U FT% ORB 3.2 0.582 5.3 0.691 3.6 0.827 0 N 2PA 4.5 6.1 6.2 0.5 1.1 53 2 0 47 1 H FGA 4.5 6.1 7.4 0.5 2.1 3.1 4.3 1.9 1.4 1 2.3 1 2.8 0.346 FG 26.7 33.6 33.1 6.5 12.6 18.9 26.5 11.7 21.1 10.7 19.9 7 0.676 0.867 38 0 1.5 0 0.404 0 3.7 0.1 1.6 1.6 4.3 64 70 10 0.8 1.2 3.9 1.1 1.6 0.4 0 0.313 1.4 18 2 2 0.9 0.4 10 1 0.633 0.636 0.655 0.5 0.667 0.5 0.5 0.6 0.4 0.5 1.4 2.9 J FG% 3P 7.6 0.592 11 0.557 15 0.493 1 0.5 5.7 0.368 6.6 0.466 6.6 0.649 4.4 0.432 4.8 0.291 3.8 0.263 4.9 0.474 3.5 0.286 19.7 0.553 0.6 1 2.4 0.5 13.5 0.43 8.2 0.505 3.8 0.409 6.1 0.438 8.1 0.399 14.9 0.546 6.3 0.348 FTA 1.9 3.7 3 0 0.5 1 2.4 0.7 1.1 0.2 0.8 0 6.3 0.2 0.4 2.3 1 0.5 28 0.25 0.207 0.282 0.2 0.304 1.3 67 2 2 1.2 0 0 1 2.5 4.7 10.9 10 0.633 63 5 63 0 30.4 4 A B 1 Player Pos 2 Steven Adec 3 Bam Adeb: PF 4 LaMarcus C 5 Kyle Alexa C 6 Nickeil Ale SG 7 Grayson Al SG 8 Jarrett Alle C 9 Kadeem Al PG 10 Al-Farouq PF 11 Justin And SG 12 Kyle Ander SF 13 Ryan Andec 14 Giannis An PF 15 Kostas Ant PF 16 Thanasis A SF 17 Carmelo A PF 18 OG Anunol SF 19 Ryan Arcid PG 20 Trevor Ariz SF 21 D.J. Augus: PG 22 Deandre AC 23 Dwayne B SG 24 Marvin Ba C 25 Lonzo Ball PG 26 Mo Bamba C 27 J.J. Barea PG 28 Harrison B PF 29 RJ Barrett SG 30 Will Bartoi SF 31 Keita Bate PF-SF Tm 26 OKC 22 MIA 34 SAS 23 MIA 21 NOP 24 MEM 21 BRK 27 NYK 29 ORL 26 BRK 26 MEM 31 HOU 25 MIL 22 LAL 27 MIL 35 POR 22 TOR 25 CHI 34 TOT 32 ORL 21 PHO 24 CHO 20 SAC 22 NOP 21 ORL 35 DAL 27 SAC 19 NYK 29 DEN 24 TOT 0 0.5 9.5 0.6 1.2 0 Q 2P% eFG% FT 7.5 0.594 0.593 10.8 0.564 0.558 12 0.519 0.532 1 0.5 0.5 2.8 0.391 0.455 2.9 0.545 0.58 6.6 0.658 0.649 2.8 0.5 0.489 2.8 0.32 0.343 0.9 0.444 0.342 3.7 0.541 0.511 1 0.5 0.357 15 0.631 0.589 0.6 1 1 1.9 0.632 0.5 9.6 0.448 0.485 4.9 0.583 0.584 1.4 0.439 0.532 2.2 0.556 0.557 4.6 0.438 0.475 14.6 0.553 0.548 4.5 0.373 0.387 11.2 0.51 0.479 4.6 0.442 0.511 2.9 0.531 0.526 4.2 0.434 0.488 7.3 0.501 0.525 9.5 0.432 0.445 7.8 0.498 0.523 3 0.504 0.5 20 2 6.5 V W DRB TRB 3.3 6 9.3 2.4 7.8 10.2 1.9 5.5 7.4 1 0.5 1.5 0.2 1.6 1.8 0.2 2 2.2 3.1 6.5 9.6 0.2 0.7 0.9 1.3 3.5 4.8 0.1 2 2.1 0.9 3.4 4.3 0 3.5 3.5 2.2 11.4 13.6 0.4 0.2 0.6 0.6 0.6 1.2 1.2 5.1 6.3 1.2 4.1 5.3 0.3 1.6 1.9 0.6 4 4.6 0.4 1.8 2.1 3.9 7.6 11.5 0.4 2.2 2.6 2.2 5.2 7.5 1.1 5 6.1 1.6 3.3 4.9 0.3 1.5 1.8 1.1 3.9 4.9 0.9 4.1 5 1.3 5 6.3 0.6 2.3 2.9 0 0.5 0 58 0.6 1.2 5.8 4.1 1.6 2.7 58 68 32.8 29.9 16 1.5 1.3 3.9 3.3 2.4 69 0.4 0.9 2.8 1.5 0.7 0.385 0.39 0.391 0.5 0.412 0.845 0.706 0.711 4.3 2.9 0.6 58 4 0.9 53 21 1.5 1.2 1.2 1.4 3.9 3.5 28.2 24.9 32.5 0.372 0.348 0.838 0.89 57 3.2 1.2 13 32 2 38 8.2 0.1 0.3 8.1 0.231 0.284 0.753 0.66 39 11 2.2 0.5 1.7 1.7 1.7 2.8 1.8 0.9 1.9 0.7 13 6 6 12.8 0.467 0.3 17.6 25.7 32.1 14.2 5.7 0.182 0.375 0.806 0.566 63 54 2.3 2 4.4 2.1 6.3 1.7 62 0 0.346 1.5 0.5 0.6 1.1 0.674 0.909 3.2 2.3 1.4 2.4 1.2 0.7 0.8 3.7 4.5 2.3 1.7 29 6 15.5 2.9 0.376 1.8 0.7 10.9 4.6 7.1 11 13 12.7 0.403 0.462 0.411 0.46 0.402 0.45 72 72 1.4 0.381 3.7 34.5 30.4 2.9 5.1 5.2 5.7 2.3 3.7 3.5 3 2.8 0.801 0.614 56 1.1 0.32 55 58 4.1 58 1.9 5 3.9 1.8 0.767 33 16.9 0.375 0.33 44 0 5.3 0.427 0.8 2.3 1.5 1.2 0.72 B G H | J K L N O P Q T U V w D E F RatingTon No. of Reviews M 96% R S Black Panther Rank 1 518 2 1 Title 2. D E F G o P R S C Age G GS MP 63 L M 3P% 2P 0 0 0.333 0 0.2 0.143 1.2 3 0.389 0 0 63 72 53 72 T U FT% ORB 3.2 0.582 5.3 0.691 3.6 0.827 0 N 2PA 4.5 6.1 6.2 0.5 1.1 53 2 0 47 1 H FGA 4.5 6.1 7.4 0.5 2.1 3.1 4.3 1.9 1.4 1 2.3 1 2.8 0.346 FG 26.7 33.6 33.1 6.5 12.6 18.9 26.5 11.7 21.1 10.7 19.9 7 0.676 0.867 38 0 1.5 0 0.404 0 3.7 0.1 1.6 1.6 4.3 64 70 10 0.8 1.2 3.9 1.1 1.6 0.4 0 0.313 1.4 18 2 2 0.9 0.4 10 1 0.633 0.636 0.655 0.5 0.667 0.5 0.5 0.6 0.4 0.5 1.4 2.9 J FG% 3P 7.6 0.592 11 0.557 15 0.493 1 0.5 5.7 0.368 6.6 0.466 6.6 0.649 4.4 0.432 4.8 0.291 3.8 0.263 4.9 0.474 3.5 0.286 19.7 0.553 0.6 1 2.4 0.5 13.5 0.43 8.2 0.505 3.8 0.409 6.1 0.438 8.1 0.399 14.9 0.546 6.3 0.348 FTA 1.9 3.7 3 0 0.5 1 2.4 0.7 1.1 0.2 0.8 0 6.3 0.2 0.4 2.3 1 0.5 28 0.25 0.207 0.282 0.2 0.304 1.3 67 2 2 1.2 0 0 1 2.5 4.7 10.9 10 0.633 63 5 63 0 30.4 4 A B 1 Player Pos 2 Steven Adec 3 Bam Adeb: PF 4 LaMarcus C 5 Kyle Alexa C 6 Nickeil Ale SG 7 Grayson Al SG 8 Jarrett Alle C 9 Kadeem Al PG 10 Al-Farouq PF 11 Justin And SG 12 Kyle Ander SF 13 Ryan Andec 14 Giannis An PF 15 Kostas Ant PF 16 Thanasis A SF 17 Carmelo A PF 18 OG Anunol SF 19 Ryan Arcid PG 20 Trevor Ariz SF 21 D.J. Augus: PG 22 Deandre AC 23 Dwayne B SG 24 Marvin Ba C 25 Lonzo Ball PG 26 Mo Bamba C 27 J.J. Barea PG 28 Harrison B PF 29 RJ Barrett SG 30 Will Bartoi SF 31 Keita Bate PF-SF Tm 26 OKC 22 MIA 34 SAS 23 MIA 21 NOP 24 MEM 21 BRK 27 NYK 29 ORL 26 BRK 26 MEM 31 HOU 25 MIL 22 LAL 27 MIL 35 POR 22 TOR 25 CHI 34 TOT 32 ORL 21 PHO 24 CHO 20 SAC 22 NOP 21 ORL 35 DAL 27 SAC 19 NYK 29 DEN 24 TOT 0 0.5 9.5 0.6 1.2 0 Q 2P% eFG% FT 7.5 0.594 0.593 10.8 0.564 0.558 12 0.519 0.532 1 0.5 0.5 2.8 0.391 0.455 2.9 0.545 0.58 6.6 0.658 0.649 2.8 0.5 0.489 2.8 0.32 0.343 0.9 0.444 0.342 3.7 0.541 0.511 1 0.5 0.357 15 0.631 0.589 0.6 1 1 1.9 0.632 0.5 9.6 0.448 0.485 4.9 0.583 0.584 1.4 0.439 0.532 2.2 0.556 0.557 4.6 0.438 0.475 14.6 0.553 0.548 4.5 0.373 0.387 11.2 0.51 0.479 4.6 0.442 0.511 2.9 0.531 0.526 4.2 0.434 0.488 7.3 0.501 0.525 9.5 0.432 0.445 7.8 0.498 0.523 3 0.504 0.5 20 2 6.5 V W DRB TRB 3.3 6 9.3 2.4 7.8 10.2 1.9 5.5 7.4 1 0.5 1.5 0.2 1.6 1.8 0.2 2 2.2 3.1 6.5 9.6 0.2 0.7 0.9 1.3 3.5 4.8 0.1 2 2.1 0.9 3.4 4.3 0 3.5 3.5 2.2 11.4 13.6 0.4 0.2 0.6 0.6 0.6 1.2 1.2 5.1 6.3 1.2 4.1 5.3 0.3 1.6 1.9 0.6 4 4.6 0.4 1.8 2.1 3.9 7.6 11.5 0.4 2.2 2.6 2.2 5.2 7.5 1.1 5 6.1 1.6 3.3 4.9 0.3 1.5 1.8 1.1 3.9 4.9 0.9 4.1 5 1.3 5 6.3 0.6 2.3 2.9 0 0.5 0 58 0.6 1.2 5.8 4.1 1.6 2.7 58 68 32.8 29.9 16 1.5 1.3 3.9 3.3 2.4 69 0.4 0.9 2.8 1.5 0.7 0.385 0.39 0.391 0.5 0.412 0.845 0.706 0.711 4.3 2.9 0.6 58 4 0.9 53 21 1.5 1.2 1.2 1.4 3.9 3.5 28.2 24.9 32.5 0.372 0.348 0.838 0.89 57 3.2 1.2 13 32 2 38 8.2 0.1 0.3 8.1 0.231 0.284 0.753 0.66 39 11 2.2 0.5 1.7 1.7 1.7 2.8 1.8 0.9 1.9 0.7 13 6 6 12.8 0.467 0.3 17.6 25.7 32.1 14.2 5.7 0.182 0.375 0.806 0.566 63 54 2.3 2 4.4 2.1 6.3 1.7 62 0 0.346 1.5 0.5 0.6 1.1 0.674 0.909 3.2 2.3 1.4 2.4 1.2 0.7 0.8 3.7 4.5 2.3 1.7 29 6 15.5 2.9 0.376 1.8 0.7 10.9 4.6 7.1 11 13 12.7 0.403 0.462 0.411 0.46 0.402 0.45 72 72 1.4 0.381 3.7 34.5 30.4 2.9 5.1 5.2 5.7 2.3 3.7 3.5 3 2.8 0.801 0.614 56 1.1 0.32 55 58 4.1 58 1.9 5 3.9 1.8 0.767 33 16.9 0.375 0.33 44 0 5.3 0.427 0.8 2.3 1.5 1.2 0.72 B G H | J K L N O P Q T U V w D E F RatingTon No. of Reviews M 96% R S Black Panther Rank 1 518 2 1 Title 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions