def product_search(product_art, product_category):
    "\n    Function to retrieve the information about products sold in the Art institute of Chicago\n\n    Parameters:\n    -------------\n    pic: the title of the artwork\n    artist: the full name of the artist\n\n    Returns:\n    -------------\n    Status code: str\n        if the API request went through\n    DataFrame: a dataframe include related info about the products and images of the products\n\n    Example:\n    -------------\n    >>>product_search('Rainy Day', 'Mug')\n    >>>0\t245410\tGustave Caillebotte Paris Street; Rainy Day Mug\t\t$9.95...\n\n    "
    params_search_product = {'q': product_art}
    rpro = requests.get('https://api.artic.edu/api/v1/products?search', params=params_search_product)
    try:
        status = rpro.status_code
    except HTTPError as http_err:
        print(f'HTTP error occurred: {http_err}')
    except Exception as err:
        print(f'Other error occurred: {err}')
    else:
        print('no error (successfully made request)')
        rpro1 = json.dumps(rpro.json(), indent=2)
        productsearch = json.loads(rpro1)
        nproduct = pd.DataFrame(productsearch['data'])
        df_len1 = len(nproduct)
        for i in range(df_len1):
            if ((product_art in nproduct.iloc[i]['title']) and (product_category in nproduct.iloc[i]['description'])):
                product_info = nproduct[['id', 'title', 'image_url', 'price_display', 'description']]

                def path_to_image_html(path):
                    return (('<img src="' + path) + '" width="60" >')
                image_cols = ['image_url']
                format_dict = {}
                for image_cols in image_cols:
                    format_dict[image_cols] = path_to_image_html
                html = display(HTML(product_info.to_html(escape=False, formatters=format_dict)))
                return html
            else:
                return 'Invalid Search! Please try other artworks or categories:)'
Function to retrieve the information about products sold in the Art institute of Chicago

Parameters:
-------------
pic: the title of the artwork
artist: the full name of the artist

Returns:
-------------
Status code: str
    if the API request went through
DataFrame: a dataframe include related info about the products and images of the products

Example:
-------------
>>>product_search('Rainy Day', 'Mug')
>>>0        245410  Gustave Caillebotte Paris Street; Rainy Day Mug         $9.95...
def product_search(product_art, product_category):
    "\n    Function to retrieve the information about products sold in the Art institute of Chicago\n\n    Parameters:\n    -------------\n    pic: the title of the artwork\n    artist: the full name of the artist\n\n    Returns:\n    -------------\n    Status code: str\n        if the API request went through\n    DataFrame: a dataframe include related info about the products and images of the products\n\n    Example:\n    -------------\n    >>>product_search('Rainy Day', 'Mug')\n    >>>0\t245410\tGustave Caillebotte Paris Street; Rainy Day Mug\t\t$9.95...\n\n    "
    params_search_product = {'q': product_art}
    rpro = requests.get('https://api.artic.edu/api/v1/products?search', params=params_search_product)
    try:
        status = rpro.status_code
    except HTTPError as http_err:
        print(f'HTTP error occurred: {http_err}')
    except Exception as err:
        print(f'Other error occurred: {err}')
    else:
        print('no error (successfully made request)')
        rpro1 = json.dumps(rpro.json(), indent=2)
        productsearch = json.loads(rpro1)
        nproduct = pd.DataFrame(productsearch['data'])
        df_len1 = len(nproduct)
        for i in range(df_len1):
            if ((product_art in nproduct.iloc[i]['title']) and (product_category in nproduct.iloc[i]['description'])):
                product_info = nproduct[['id', 'title', 'image_url', 'price_display', 'description']]

                def path_to_image_html(path):
                    return (('<img src="' + path) + '" width="60" >')
                image_cols = ['image_url']
                format_dict = {}
                for image_cols in image_cols:
                    format_dict[image_cols] = path_to_image_html
                html = display(HTML(product_info.to_html(escape=False, formatters=format_dict)))
                return html
            else:
                return 'Invalid Search! Please try other artworks or categories:)'