Stephen J. Mildenhall
2024-02-24
2024-03-06
OUP VSI Site
Source: Wikipedia.org
Page created dynamically using Listing 1.
import pandas as pd import re from itables import show, init_notebook_mode # init_notebook_mode(all_interactive=True) df = pd.read_html( 'https://en.wikipedia.org/wiki/List_of_Very_Short_Introductions_books') df = df[0] df.columns = ['Ord', 'Topic', 'Author', 'Date' ,'drop', 'Category'] df = df.drop(columns='drop') # fix date pattern = r"\d{1,2} \w+ \d{4}( \d{1,2} \w+ \d{4}) \(2nd ed\.\)" replacement = r"\1" df['Date'] = df['Date'].apply(lambda x: re.sub(pattern, replacement, x)) # re order df = df[['Ord', 'Topic', 'Category', 'Author', 'Date']] show(df, caption='Table of VSI books.', classes="display nowrap compact", lengthMenu=[25, 50, 100, -1])