Select Page

1.3 Lobsterland’s 2021 Data


Many of the code examples in this chapter are based on the lobsterland_2021.csv dataset.  This dataset, along with the other datasets used throughout this book, is available for download at lobsterland.net/datasets.

In the screenshot shown above, the dataset is brought into the local environment with the help of the read_csv() function from pandas.  Pandas (from ‘panel data’) is a Python library with many functions that are useful in data science, including the handling of common tabular data structures and the manipulation of data.  There is a phenomenal amount of information available to users at the pandas home page.  

The other import statement here is “import numpy as np.”  Numpy (from ‘numerical Python’) is a library with many useful functions for handling mathematical operations.  Numpy also has an informative home page with extensive details about its functions and purposes.  

Technically, there is no requirement to use an alias when importing a package – we could skip the ‘as np’ and ‘as pd’ abbreviations without encountering an error.  However, you should always use conventional aliasing statements when importing libraries in Python.  Writing the import statements this way serves two important purposes:  first, it means that you can avoid repeatedly typing the entire library name each time you want to use one of its functions; and second, it makes your coding style consistent and compatible with the examples that you will find in nearly any Python book, online tutorial, official reference, or other example.  

The head() function shown here offers a “sneak preview” of the dataframe, with the first five rows being printed as output in the notebook.  Note that Python is 0-based, so those rows are numbered 0 through 4, rather than 1 through 5.

Please note that the rest of the code examples throughout this chapter assume that ‘pandas’ and ‘numpy’ have already been imported into the user’s environment.  

A dataset description of lobsterland_2021.csv is contained below:

VariableDescription
DateThis variable shows the date that corresponds to each particular row in the dataset.  
Day_of_WeekThis shows the day of the week.  Lobster Land’s summer season starts on a Monday holiday (Memorial Day) and ends on a Monday holiday (Labor Day), so there is one “extra” Monday in the dataset, compared with the other days.  
MaxThe highest recorded temperature for that particular day in Portland, Maine (LobsterLand is located just outside of Portland)
AverageThe average recorded temperature for that particular day in Portland, Maine (LobsterLand is located just outside of Portland)
MinThe lowest recorded temperature for that particular day in Portland, Maine (LobsterLand is located just outside of Portland)
PrecipAmount of rainfall for that day, measured in inches
DayPassThis shows the number of day passes sold for that particular day. A day pass enables its holder to get unlimited rides, and access to all the park’s amenities, for one particular day.
UniqueVisitorThe total number of unique visitors to enter the park on a particular day.  This will be greater than the ‘DayPass’ number because it also includes season pass holders, employees who enter for free on their off-days, and some other assorted types of guests.
AvgDurationThis shows the amount of time, in minutes, the visitors spend inside the park, on average.
ParkingRevThis is the total daily revenue from the parking lot, for that day, measured in dollars.  
SnackShackRevThis is the total daily revenue from the Snack Shack, for that day, measured in dollars.   The Snack Shack at LobsterLand sells candy, ice cream, soda, fried dough, and other things that kids (and some grown-up kids!) love to eat.
LobsteramaRevThis is the total daily revenue from Lobsterama, for that day, measured in dollars. Lobsterama is a sit-down, full-service restaurant inside Lobster Land that serves many types of food, all throughout the day.  
GoldZoneRevThis is the total daily revenue from the Gold Zone, for that day, measured in dollars. The Gold Zone is an arcade at Lobster Land.    
MerchRevThis is the total daily revenue from the Lobster Land merchandise store, for that day, measured in dollars.    
StaffHoursThis shows the total number of staff hours per day.  Each hour worked by each park employee counts towards this value.  
Sign_Ups2022Throughout the 2021 season, LobsterLand set up a table inside the park, at which they encouraged people to sign up for 2022 season passes.  This is a count variable that indicates the number of people who signed up at the table.  
FireworksA “1” here means that there was a nighttime fireworks show at Lobster Land on this date, while a “0” means that there were no fireworks.  
SpecEventA “1” here means that there was no special event held.  A “2” here means that there was a live comedy show.  A “3” means that there was a live country music show.  A “4” means that there was a live rock music show.  A “5” means that there was a poetry reading, and a “6” means that there was a children’s-themed show.  
DailyGrossRevThis is the total daily revenue generated by Lobster Land.  Note that this is not a sum of the other revenue variables, as there are some other revenue sources for the park beyond the ones shown here.  
day_typeThis is a categorical variable with 8 levels:  Overcast, Partly Cloudy, Cloudy, Sunny, Partly Sunny, Very Sunny, Rainy, Very Rainy.  Overcast means that the sky is covered with clouds (all gray, no blue)