Task 1: Instructions
Run the code cell below “1. This is a Jupyter Notebook!” by clicking the run cell button ( ▶| Run ) or hitting Ctrl + Enter. This will calculate how many children were born per day on average in 2016.
Then, click the Next Task button below.
# I'm a code cell, click me, then run me!
256 * 60 * 24 # Children × minutes × hours
368640
Task 2: Instructions
Replace the arguments to greet(‘James’, ‘Bond’) with your own name.
Run the code cell. (As this is part of every task we will drop this instruction from now on.)
def greet(first_name, last_name):
greeting = 'My name is ' + last_name + ', ' + first_name + ' ' + last_name + '!'
return greeting
# Replace with your first and last name.
# That is, unless your name is already James Bond.
greet('Daisy', 'Lee')
'My name is Lee, Daisy Lee!'
Task 3: Instructions
Read in the dataset datasets/global_temperature.csv and take a look at the first couple of rows
# Importing the pandas module
import pandas as pd
# Reading in the global temperature data
global_temp = pd.read_csv('datasets/global_temperature.csv')
# Take a look at the first datapoints
# ... YOUR CODE FOR TASK 3 ...
global_temp.head()
year degrees_celsius
0 1850 7.74
1 1851 8.09
2 1852 7.97
3 1853 7.93
4 1854 8.19
Task 4: Instructions
Add any suitable labels to the x-axis and y-axis of the plot.
# Setting up inline plotting using jupyter notebook "magic"
%matplotlib inline
import matplotlib.pyplot as plt
# Plotting global temperature in degrees celsius by year
plt.plot(global_temp['year'], global_temp['degrees_celsius'])
# Adding some nice labels
plt.xlabel('year')
plt.ylabel('degrees celsius')
Task 5: Instructions
Replace the … in each label with the market share percentage for each smartphone company in companies.
# Making a map using the folium module
import folium
phone_map = folium.Map()
# Top three smart phone companies by market share in 2016
companies = [
{'loc': [37.4970, 127.0266], 'label': 'Samsung: 20.5%'},
{'loc': [37.3318, -122.0311], 'label': 'Apple: 14.4%'},
{'loc': [22.5431, 114.0579], 'label': 'Huawei: 8.9%'}]
# Adding markers to the map
for company in companies:
marker = folium.Marker(location=company['loc'], popup=company['label'])
marker.add_to(phone_map)
# The last object in the cell always gets shown in the notebook
phone_map
Task 6: Instructions
Are you ready to get started with DataCamp projects, True or False?
Check your project by clicking the Check Project button!
# Are you ready to get started with DataCamp projects?
I_am_ready = True
# Ps.
# Feel free to try out any other stuff in this notebook.
# It's all yours!