Skip to content
Denis Karani - Data Scholarship Competition
Everyone Can Learn Data Scholarship
1๏ธโฃ Part 1 (Python) - Dinosaur data ๐ฆ
๐ Background
You're applying for a summer internship at a national museum for natural history. The museum recently created a database containing all dinosaur records of past field campaigns. Your job is to dive into the fossil records to find some interesting insights, and advise the museum on the quality of the data.
๐พ The data
You have access to a real dataset containing dinosaur records from the Paleobiology Database (source):
| Column name | Description |
|---|---|
| occurence_no | The original occurrence number from the Paleobiology Database. |
| name | The accepted name of the dinosaur (usually the genus name, or the name of the footprint/egg fossil). |
| diet | The main diet (omnivorous, carnivorous, herbivorous). |
| type | The dinosaur type (small theropod, large theropod, sauropod, ornithopod, ceratopsian, armored dinosaur). |
| length_m | The maximum length, from head to tail, in meters. |
| max_ma | The age in which the first fossil records of the dinosaur where found, in million years. |
| min_ma | The age in which the last fossil records of the dinosaur where found, in million years. |
| region | The current region where the fossil record was found. |
| lng | The longitude where the fossil record was found. |
| lat | The latitude where the fossil record was found. |
| class | The taxonomical class of the dinosaur (Saurischia or Ornithischia). |
| family | The taxonomical family of the dinosaur (if known). |
The data was enriched with data from Wikipedia.
๐ช Challenge I
Help your colleagues at the museum to gain insights on the fossil record data. Include:
- How many different dinosaur names are present in the data?
- Which was the largest dinosaur? What about missing data in the dataset?
- What dinosaur type has the most occurrences in this dataset? Create a visualization (table, bar chart, or equivalent) to display the number of dinosaurs per type. Use the AI assistant to tweak your visualization (colors, labels, title...).
- Did dinosaurs get bigger over time? Show the relation between the dinosaur length and their age to illustrate this.
- Use the AI assitant to create an interactive map showing each record.
- Any other insights you found during your analysis?
# Import the pandas and numpy packages
import pandas as pd
import numpy as np
# Load the data
dinosaurs = pd.read_csv('data/dinosaurs.csv')# Preview the dataframe
dinosaurs[:10]Shape of the dataframe
dinosaurs.head()
print(dinosaurs.shape)1. Dinosaur names present
dinosaur_names = dinosaurs.loc[:, 'name'].unique()
print(f"The different dinosaur names present are {len(dinosaur_names)}.\n")
print("The names are: ")
for name in dinosaur_names:
print(name)2. Missing Values
missing_vals = dinosaurs.isnull().sum()
for column, val in missing_vals.items():
print(f"Column {column}: has {val} missing values")Largest Dinosaur
longest = dinosaurs['length_m'].max()
print(f"The largest dinosaur was {longest} long\n")
nme = dinosaurs[dinosaurs['length_m'] == longest]
print(nme['name'])3. Most Occurences
โ
โ
โ
โ
โ