final_project_shiyinglai package

Submodules

final_project_shiyinglai.final_project_shiyinglai module

final_project_shiyinglai.final_project_shiyinglai.artwork_for_today(apikey)[source]

Request an image of artwork that enter the Harvard Museum at today in history.

Parameters

apikey (String) – your API key for The Harvard Museum API

Returns

an image

Return type

PIL.JpegImagePlugin.JpegImageFile

Examples

>>>from io import BytesIO >>>from datetime import date >>>import urllib3 >>>import json >>>import pandas as pd >>>import matplotlib. pyplot as plt >>>artwork_for_today(apikey=”your api key”) >>> An Image

final_project_shiyinglai.final_project_shiyinglai.exhibition_explorer(apikey, exhibition)[source]

Get the information of artwork for a particualr exhibition in the Harvard Museum from the The Harvard Museum API based on query parameters.

Parameters
  • apikey (String) – your API key for The Harvard Museum API

  • exhibition (String) – The exact name of exhibition that showed in the Harvard Museum website.

Returns

A dataframe that contains the information about artworks appearing in that exhibition.

Return type

pandas.core.frame.DataFrame

Examples

>>>import pandas as pd >>>import json >>>import urllib3 >>>exhibition_explorer(apikey=”your api key”,exhibition=”Botticelli’s Witness: Changing Style in a Changing Florence”) >>> A dataframe

final_project_shiyinglai.final_project_shiyinglai.function_search_for_artworks(title, vague_search, apikey)[source]

Search Artwork by title from the The Harvard Museum API based on query parameters.

Parameters
  • apikey (String) – your API key for The Harvard Museum API

  • title (String) – The title of the artwork you want to look up.ex.”Pouring Vessel”

  • vague_search (Boolean) – True: return all the artwork contains the title False:return one artwork has that exactly title Note: When you enter False, and your title is not exactly the same as the havard museum provide. You will receive nothing.

Returns

A dataframe that contains some information about the artwork based on the title you entered.

Return type

pandas.core.frame.DataFrame

Examples

>>>import pandas as pd >>>import json >>>import urllib3 >>>function_search_for_artworks(title=”Pouring Vessel”, vague_search=True,apikey=”your api key”) >>> A dataframe contains many records >>>function_search_for_artworks(title=”Pouring Vessel”, vague_search=False,apikey=”your api key”) >>> A dataframe contains one record

final_project_shiyinglai.final_project_shiyinglai.search_artwork_by_culture(apikey, culture, page)[source]

Search Artwork by culture from the The Harvard Museum API based on query parameters.

Parameters
  • apikey (String) – your API key for The Harvard Museum API

  • culture (String) – The culture you want to look up.ex.”Chinese”

  • page (String) – This API could only return 100 records per request ar maxium. One request is counted as 1 page. if you want to see more records. Enter the number of Page. ex. “2” or “3” Note: only integer in string format.Please enter “1” at the first time.

Returns

A dataframe that contains the ‘id’,”title”,’objectnumber’,’century’,’worktypes’,’culture’,’technique’,’medium’,’description’, ‘classificationid’,’colorcount’ based on thee query_parameter you entered.

Return type

pandas.core.frame.DataFrame

Examples

>>>import pandas as pd >>>import json >>>import urllib3 >>>search_artwork_by_culture(apikey=”your api key”,culture=”Chinese”,page=”1”) >>> A dataframe

final_project_shiyinglai.final_project_shiyinglai.search_for_images_by_height(height, apikey, page)[source]

Search images by size from the The Harvard Museum API based on query parameters.

Parameters
  • apikey (String) – your API key for The Harvard Museum API

  • height (String) – The height of the image. ex. “>400”

  • page (String) – This funtion could only return 10 records per request. One request is counted as 1 page. if you want to see more records. Enter the number of Page. ex. “2” or “3” Note: only integer in string format.Please enter “1” at the first time.

Returns

10 images

Return type

matplotlib.image.AxesImage

Examples

>>>import pandas as pd >>>import json >>>import urllib3 >>>import requests >>>from PIL import Image >>>from io import BytesIO >>>import matplotlib. pyplot as plt >>>search_for_images_by_size(height=”>400”,apikey=”your api key”) >>> An matplotlib.image.AxesImage

final_project_shiyinglai.final_project_shiyinglai.search_for_images_by_width(width, apikey, page)[source]

Search images by width from the The Harvard Museum API based on query parameters.

Parameters
  • apikey (String) – your API key for The Harvard Museum API

  • width (String) – The width of the image. ex.”>1000”

  • page (String) – This funtion could only return 10 records per request. One request is counted as 1 page. if you want to see more records. Enter the number of Page. ex. “2” or “3” Note: only integer in string format.Please enter “1” at the first time.

Returns

10 images

Return type

matplotlib.image.AxesImage

Examples

>>>import pandas as pd >>>import json >>>import urllib3 >>>import requests >>>from PIL import Image >>>from io import BytesIO >>>import matplotlib. pyplot as plt >>>search_for_images_by_size(width=”>1000”,apikey=”your api key”) >>> An matplotlib.image.AxesImage

final_project_shiyinglai.final_project_shiyinglai.trendplot_for_particular_artwork_type(artwork_type, apikey)[source]

Gnerate a trend plot for the number of certain artwoork type during 10th -20th century’s .

Parameters
  • apikey (String) – your API key for The Harvard Museum API

  • artwork_type (String) – The artwork type you want to generate trend plot. ex.”sculpture”

Returns

A trend plot for 10th -20th century.

Return type

A bar plot

Examples

>>>import urllib3 >>>import json >>>import pandas as pd >>>import matplotlib. pyplot as plt >>>trendplot_for_particular_artwork_type(artwork_type=”sculpture”, apikey=”your api key”) >>> An trend plot

Module contents