Skip to content
0

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

๐Ÿ“– Background

The local government environment agency is undertaking a project focused on developing pollinator bee-friendly spaces. These spaces aim to provide an optimized environment for pollinator bees, allowing them to thrive and contribute to a healthy ecosystem. The agency has collected data on both native and non-native plants and their impact on pollinator bees.

To effectively create these bee-friendly spaces, it is crucial to choose the right plants that will attract and support the bees. Native plants are those naturally occurring in the local ecosystem, while non-native plants are introduced from other regions or countries. Both types of plants can be utilized in this project.

The collected data on native and non-native plants will serve as the basis for analysis. By examining the effects of different plant species on pollinator bees, patterns and correlations can be identified. The analysis aims to determine which plants are most beneficial for the bees, offering them suitable food sources, shelter, and nesting opportunities.

Ultimately, the goal is to provide recommendations based on the data analysis. These recommendations will guide the selection of plants for creating optimized environments in the bee-friendly spaces, ensuring the best possible conditions for the pollinator bees to thrive and contribute to a healthier and more sustainable ecosystem.

๐Ÿ’พ The Data

The data regarding the research on plants and bees can be found in the file named 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)

Importing Library

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np

Data Extraction and Cleaning

data_raw = pd.read_csv("data/plants_and_bees.csv")
data_raw

In this dataset, there are some values that are missing or not applicable. In the nonnative_bee columns, these missing values are represented as "Null" Additionally, in the plant_species column, there is a value of "None" which indicates the sample was taken from the air and not associated with a specific plant.

To analyze the plant preferences of either native or nonnative bee species, it is important to remove these missing or irrelevant values from the dataset.

#Drop the missing values
data = data_raw[data_raw['plant_species'] != 'None'].dropna(subset=['nonnative_bee'])

Data Grouping : Native and Non-Native Species

In Data Grouping, we focus on categorizing bee species into two distinct groups: native bee species and non-native bee species. Our objective is to acquire knowledge regarding the plant preferences of native and non-native bee species.

#Plant preferences of Native Bee Species
native_species = data[data['nonnative_bee']==0]
native_preferences = native_species['plant_species'].value_counts()

#Plant preferences of Non-Native Bee Species
non_native_species = data[data['nonnative_bee'] == 1]
non_native_preferences = non_native_species['plant_species'].value_counts()

Visualization of Plant Preferences of Native vs Non-Native Bee Species

plt.figure(figsize=(10, 6))
plt.bar(native_preferences.index, native_preferences.values, label='Native Bees')
plt.bar(non_native_preferences.index, non_native_preferences.values, label='Non-Native Bees')
plt.xlabel('Plant Species')
plt.ylabel('Frequency')
plt.title('Plant Preferences of Native vs Non-Native Bees')
plt.legend()
plt.xticks(rotation=90)
plt.show()

โ€Œ
โ€Œ
โ€Œ