<jupyter_start><jupyter_text>This notebook reads am xml file comntaining occupation titles and four image URLS to creates an HTML dataframe and webpage with four rendered images of each job description contained in the Bureau of Labor Statistics (BLS) Occupational Outlook Handbook (OOH). The images are those taken from thumbnails shown at the occupation group level (1) and from those shown in each of the following tabs at the individual occupation level (3): `What They Do`, `Work Environment`, `How to Become One`.<jupyter_code>import pandas as pd
import numpy as np
from IPython.core.display import HTML
# Read images into df
ooh_images = pd.read_csv(r"OOH_Image_Data.txt", sep='|')
ooh_images
from IPython.core.display import HTML
# Function to convert links to html tags
def path_to_image_html(path):
    return '<img src="'+ path + '" width="60" >'
# Rendering df as HTML table
ooh_images.to_html(escape=False, 
                   formatters=dict(Image_1=path_to_image_html,
                                   Image_2=path_to_image_html,
                                   Image_3=path_to_image_html,
                                   Image_4=path_to_image_html
                                  )
                  )
# Rendering images in df using HTML method
HTML(ooh_images.to_html(escape=False,
                        formatters=dict(Image_1=path_to_image_html,
                                        Image_2=path_to_image_html,
                                        Image_3=path_to_image_html,
                                        Image_4=path_to_image_html
                                       )
                       )
    )
# Saving the dataframe as a webpage
ooh_images.to_html("ooh_images.html",
                   escape=False, 
                   formatters=dict(Image_1=path_to_image_html,
                                   Image_2=path_to_image_html,
                                   Image_3=path_to_image_html,
                                   Image_4=path_to_image_html
                                  )
                  )<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05629770992366412, 'fraction_numerical': 0.007633587786259542, 'mean_word_length': 1.7411764705882353, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '289241', 'license': 'MIT', 'n_tokens_mistral': 563, 'n_tokens_neox': 532, 'n_words': 151, 'path': 'src/ooh_image.ipynb', 'repo_name': 'sknalluri/predicting_demographics', 'size': '2096'}