# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# Import dependencies
    # You'll need Pandas
import pandas as pd

# Declare a variable called 'url' 
    # and set it to the following link 
    # 'https://en.wikipedia.org/wiki/List_of_2018_box_office_number-one_films_in_the_United_States'
url = 'https://en.wikipedia.org/wiki/List_of_2018_box_office_number-one_films_in_the_United_States'

# Declare a variable called 'tables' and use pandas to parse through the url to retrieve all table data within the url.
tables = pd.read_html(url)
tables

# Check the type of data in tables, should be list.
type(tables)

# +
# Set your new information in 'tables' to a dataframe.
df = tables[0]


# Give your dataframe new column names.
df.columns = ['Number','Date','Film','Gross','Note(s)']

# Display the first 5 rows in the dataframe.
df.head()

# df

# +
# Be sure to drop the first row, if they include the column names.
df = df.iloc[1:]

# Display the first 10 rows in the dataframe.
df.head(10)
# -

# Save the data as an html.
df.to_html('table_data.html')






StarcoderdataJupyterScriptsDedupFiltered