Skip to content
0

Which plants are better for bees: native or non-native?

๐Ÿ“– Background

You work for the local government environment agency and have taken on a project about creating pollinator bee-friendly spaces. You can use both native and non-native plants to create these spaces and therefore need to ensure that you use the correct plants to optimize the environment for these bees.

The team has collected data on native and non-native plants and their effects on pollinator bees. Your task will be to analyze this data and provide recommendations on which plants create an optimized environment for pollinator bees.

๐Ÿ’พ The Data

You have assembled information on the plants and bees research in a file called plants_and_bees.csv. Each row represents a sample that was taken from a patch of land where the plant species were being studied.

ColumnDescription
sample_idThe ID number of the sample taken.
bees_numThe total number of bee individuals in the sample.
dateDate the sample was taken.
seasonSeason during sample collection ("early.season" or "late.season").
siteName of collection site.
native_or_nonWhether the sample was from a native or non-native plot.
samplingThe sampling method.
plant_speciesThe name of the plant species the sample was taken from. None indicates the sample was taken from the air.
timeThe time the sample was taken.
bee_speciesThe bee species in the sample.
sexThe gender of the bee species.
specialized_onThe plant genus the bee species preferred.
parasiticWhether or not the bee is parasitic (0:no, 1:yes).
nestingThe bees nesting method.
statusThe status of the bee species.
nonnative_beeWhether the bee species is native or not (0:no, 1:yes).

Source (data has been modified)

๐Ÿ’ช Challenge

Provide your agency with a report that covers the following:

  • Which plants are preferred by native vs non-native bee species?
  • A visualization of the distribution of bee and plant species across one of the samples.
  • Select the top three plant species you would recommend to the agency to support native bees.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")

data = pd.read_csv("data/plants_and_bees.csv")
data
data.info()
native_bees = data['nonnative_bee'].value_counts(normalize=True, ascending=True)
native_plots = data['native_or_non'].value_counts(normalize=True)
labels = ['non-native', 'native']

fig, ax = plt.subplots(1, 2, figsize=(8,8))
ax[0].pie(native_bees, autopct='%1.1f%%', shadow=True, startangle=140, labels=labels, colors=['#459e97', '#e68193'])
ax[0].set_title('Bees')
ax[1].pie(native_plots, autopct='%1.1f%%', shadow=True, startangle=140, labels=labels, colors=['#459e97', '#e68193'])
ax[1].set_title('Plots')
plt.show()

It seems that there is a clear predominance of native bee species and a very small predominance of non-native plant species.

Note: The "nonnative_bee" variable may be a bit confusing. So, after an internet research I ascertained that the 0's actually refer to native bees, and the 1's to non-native bees.

# Check which are the non-native bee species
data.query("nonnative_bee == 1")['bee_species'].unique()

There are apparently only three non-native bee species, Apis mellifera, also known as the European honey bee, which is native to Africa, Asia, and Europe, Osmia taurus and Anthidium manicatum (European wool carder bee), which is native to Europe, Asia and North Africa.

plt.figure(figsize=(12, 6))
sns.countplot(x='plant_species', data=data[data['plant_species'] != 'None'], order=data['plant_species'].value_counts().index[1:])
plt.xticks(rotation=90)
plt.xlabel('Plant Species')
plt.ylabel('Count')
plt.title('Count of Plant Species')
plt.show()

The top 5 most common plant species are Leucanthemum vulgare (Oxeye daisy, non-native), Rudbeckia hirta (Black-eyed Susan, native), Daucus carota (Wild carrot, non-native), Melilotus officinalis (Sweet yellow clover, non-native) and Cichorium intybus (Chicory, non-native)

top_15_bee_species = data['bee_species'].value_counts().head(15)
plt.figure(figsize=(12, 6))
sns.countplot(x='bee_species', data=data, order=top_15_bee_species.index)
plt.xticks(rotation=90)
plt.xlabel('Bee Species')
plt.ylabel('Count')
plt.title('Count of Top 15 Bee Species')
plt.show()

The most common bee species is, by far, Halictus poeyi/ligatus (Poey's furrow bee, native). The next most common are Augochlorella aurata (native) and Lasioglossum pilosum (native)

โ€Œ
โ€Œ
โ€Œ