Reader Capabilities

Function to read data from Google Sheets

reader.clean_dataframe(DF)

Cleans the input DataFrame by dropping the ‘Timestamp’ column and converting the ‘date_time_of_airport_arrival’ and ‘date_time_of_hotel_departure’ columns from strings to datetime objects.

Parameters:

DF (pandas.DataFrame) – The DataFrame to clean.

Returns:

The cleaned DataFrame.

Return type:

pandas.DataFrame

reader.read_google_sheet(sheet_id)

Reads in a Google Sheet as a CSV file using pandas. Ensure that the sharing setting for the sheet allows anyone with the link to access it.

Parameters:

sheet_id (str, optional) – The ID of the Google Sheet, extracted from the webpage as ‘/d/{sheet_id}/gviz/tq?tqx=out:csv’. If None, it uses a default ID. Defaults to None.

Returns:

A DataFrame containing the information from the Google Sheet. The “Timestamp”

column is removed, and “date_time_of_airport_arrival” and “date_time_of_hotel_departure” columns are converted into datetime objects.

Return type:

pandas.DataFrame

Raises:
  • pandas.errors.ParserError – If parsing the CSV file fails.

  • urllib.error.HTTPError – If the sheet ID is invalid, or the sheet doesn’t allow public access.

Note

The default sheet ID used when none is provided is ‘1riOck-CL8RjVkt_dgcgWhd0DWhUWMifpyb6VLngTrHs’.