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.
species_numThe number of different bee species 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 plant.
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.

πŸ§‘β€βš–οΈ Judging criteria

This is a community-based competition. The top 5 most upvoted entries will win.

The winners will receive DataCamp merchandise.

βœ… Checklist before publishing

  • Rename your workspace to make it descriptive of your work. N.B. you should leave the notebook name as notebook.ipynb.
  • Remove redundant cells like the judging criteria, so the workbook is focused on your work.
  • Check that all the cells run without error.

βŒ›οΈ Time is ticking. Good luck!

Outline

In order to answer the question, we'll proceed as follow:

  1. Data Loading and Pre-analysis: Basically we'll load the data and try to have a first sight of what it looks like, and what kind of preprocessing it needs if there are any
  2. Data pre-processing

1. Data Loading and pre-analysis

import pandas as pd
data = pd.read_csv("data/plants_and_bees.csv")
data.head()
data.info()
Notes

Here we can see that we might need to handle a few null values on some columns (all columns should have 1250 non-null count in them in order to match the 1250 entries).

For some columns, it might be normal for them to have null values, but there are others that should be filled with values. For instance with the parasitic column, as far as I know, it should always have a value because a bee can only be parasitic or non-parasitic. Same goes with the nonnative bee and we could also apply the same logic to the nesting method.

Let's first take a closer look at these rows that shouldn't have null values.

parasitic_null = data[data["parasitic"].isnull()]
parasitic_null.info()
nonnative_null = data[data["nonnative_bee"].isnull()]
nonnative_null.info()
nesting_null = data[data["nesting"].isnull()]
nesting_null.info()
β€Œ
β€Œ
β€Œ