Skip to content
Bee Haven Revealed
Bee Haven Revealed: Unlocking the Top Plant Species for Thriving Pollinator Bee Populations
💪 Challenge
- 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.
Introduction
Unveiling the Secrets to a Flourishing Pollinator Paradise: Discover the Key Plant Species that Nourish and Sustain pollinator Bee Populations
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import seaborn as sns
import ipywidgets as widgets
from IPython.display import display, HTML
import numpy as np
from PIL import Image
import base64
import io
data = pd.read_csv("data/plants_and_bees.csv")
data.info()#preview of rows and columns in the dataset
data.head(50)specialization_counts=data['specialized_on'].value_counts()
print(specialization_counts)Which plants are preferred by native vs non-native bee species?
#Separating Native and Non-Native Bee Species
native_species = data[data['nonnative_bee']==0]
non_native_species = data[data['nonnative_bee']==1]# Group the data by plant species and calculate the counts for each group
native_counts = native_species['plant_species'].value_counts(dropna=False)
non_native_counts = non_native_species['plant_species'].value_counts(dropna=False)# Display the value counts for native and non-native bee species
print("Native Bee Species - Preferred Plant Species:")
print(native_counts)
print("\nNon-Native Bee Species - Preferred Plant Species:")
print(non_native_counts)# Plot the preferred plant species for native and non-native bee species
plt.figure(figsize=(10, 6))
# Plot for native bee species
plt.bar(native_counts.index, native_counts.values, label='Native Bee Species')
# Plot for non-native bee species
plt.bar(non_native_counts.index, non_native_counts.values, label='Non-Native Bee Species')
plt.xlabel('Plant Species')
plt.ylabel('Count')
plt.title('Preferred Plant Species by Native vs. Non-Native Bee Species')
plt.xticks(rotation=90)
plt.legend()
plt.show()Based on the above chart, here are the preferred plant species for native and non-native bee species:
Preferred Plant Species for Native Bee Species:
- None (762 occurrences)
- Leucanthemum vulgare (102 occurrences)
- Rudbeckia hirta (51 occurrences)
- Daucus carota (31 occurrences)
- Cichorium intybus (25 occurrences)
- Chamaecrista fasciculata (23 occurrences)
- Trifolium pratense (21 occurrences)
- Helenium flexuosum (19 occurrences)
- Melilotus officinalis (16 occurrences)
- Penstemon digitalis (15 occurrences)
- Asclepias tuberosa (13 occurrences)
- Coronilla varia (12 occurrences)
- Rudbeckia triloba (12 occurrences)
- Monarda punctata (10 occurrences)
- Cosmos bipinnatus (9 occurrences)
- Trifolium repens (6 occurrences)
- Lobularia maritima (5 occurrences)
- Agastache foeniculum (5 occurrences)
- Pycnanthemum tenuifolium (4 occurrences)
- Viola cornuta (3 occurrences)
- Tradescantia virginiana (3 occurrences)
- Lotus corniculatus (3 occurrences)
- Trifolium incarnatum (2 occurrences)
- Origanum vulgare (2 occurrences)
Preferred Plant Species for Non-Native Bee Species:
- None (33 occurrences)
- Trifolium incarnatum (1 occurrence)
- Daucus carota (1 occurrence)
These lists show me the plant species preferred by native and non-native bee species. However, based on the counts in the dataset, the "None" category is highest. This could indicate that in those instances, the samples were taken from the air rather than from a specific plant species.
Distribution of bee and plant species
Searching for sample ID with greatest number of instances in the dataset to plot and visualize best distribution