Skip to content
0

Pet preference in UK 🐱🐶

📖 1) Background

You and your friend have debated for years whether cats or dogs make more popular pets. You finally decide to settle the score by analyzing pet data across different regions of the UK. Your friend found data on estimated pet populations, average pets per household, and geographic factors across UK postal code areas. It's time to dig into the numbers and settle the cat vs. dog debate!

📕 2) Executive summary

Pet ownership, both cats and dogs per household, is influenced by geographic and environmental factors. Typically, residential areas have higher pet ownership rates than non-residential areas, and rural areas tend to have higher rates than urban areas due to the availability of open spaces. Regions such as Wales, South West England, and Scotland exhibit higher pet ownership rates too.

In the UK, dogs are generally more popular than cats as pets, as evidenced by higher numbers of dogs per household across all regions. This preference for dogs may be attributed to their perceived loyalty, affection, and protective instincts, as well as their traditional roles in UK culture.

Conducting further research online, I discovered that London is the only region in the UK where cat ownership is higher than dog ownership. However, among the 2830 data points analyzed, all regions show a higher number of dogs per household than cats per household. This may suggest a lack of data points supporting a preference for cats in London, aligning with the minimal difference in cat and dog ownership observed in the city.

💻 3) Fun Fact! Popular pet breeds in UK

Top 3 Popular Cat Breeds:

  • British Shorthair: Known for their plush coat and round face, British Shorthairs are a symbol of British heritage. They are admired for their calm and friendly nature, making them great companions.
  • Bengal: Bengal cats are known for their striking leopard-like appearance with a luxurious coat and expressive eyes. They are energetic and playful, often seeking interaction with their owners.
  • Siamese: Siamese cats are famous for their sleek, slender bodies and striking blue almond-shaped eyes. They are vocal and affectionate, often forming strong bonds with their human companions.

Top 3 Popular Dog Breeds:

  • Labrador Retriever: Labrador Retrievers are renowned for their friendly nature and intelligence. They are often used as service dogs due to their trainability and gentle temperament.
  • Border Collie: Border Collies are highly intelligent and energetic dogs, known for their herding abilities. They excel in agility and obedience training, making them popular working and sporting dogs.
  • Cockapoo: Cockapoos are a crossbreed between Cocker Spaniels and Poodles, known for their hypoallergenic coats and friendly personalities. They are often sought after as family pets due to their affectionate nature.

Acknowledgments:
Data obtained from these sources: Dog breeds, Cat breeds
Photo generated from Gemini

💾 4) The data

There are three data files, which contains the data as follows below.

The population_per_postal_code.csv data contains these columns:

ColumnDescription
postal_codeAn identifier for each postal code area
estimated_cat_populationThe estimated cat population for the postal code area
estimated_dog_populationThe estimated cat population for the postal code area

The avg_per_household.csv data contains these columns:

ColumnDescription
postal_codeAn identifier for each postal code area
cats_per_householdThe average number of cats per household in the postal code area
dogs_per_householdThe average number of dogs per household in the postal code area

The postal_code_areas.csv data contains these columns:

ColumnDescription
postal_codeAn identifier for each postal code area
townThe town/towns which are contained in the postal code area
countyThe UK county that the postal code area is located in
populationThe population of people in each postal code area
num_householdsThe number of households in each postal code area
uk_regionThe region in the UK which the postal code is located in

The additional ukpostcodes.csv data contains these columns:

ColumnDescription
idA unique identifier for each row in the dataset
postcodeAn identifier for each postal code area
latitudeThe latitude of the region in the postal code area
longitudeThe longitude of the region in the postal code area

Acknowledgments:
Data has been assembled and modified from two different sources: Animal and Plant Health Agency, Postcodes
Additional dataset: UK Postcodes with Latitude and Longitutde

# Install necessary libraries
!pip install adjustText
# Import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from wordcloud import WordCloud
from adjustText import adjust_text '

from sklearn.linear_model import LinearRegression

4.1) Load data

# Import population_per_postal_code data
population_raw_data = pd.read_csv('data/population_per_postal_code.csv')
population_raw_data
# Display a random sample of 25 rows from the population_raw_data DataFrame
population_raw_data.sample(25, random_state=0)
# Import avg_per_household data
avg_raw_data = pd.read_csv('data/avg_per_household.csv')
# Rename 'postcode' to 'postal_code' for ease of merging with another DataFrame
avg_raw_data = avg_raw_data.rename(columns={'postcode': 'postal_code'})
avg_raw_data