All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.
All our activities include solutions with explanations on how they work and why we chose them.
Write the function
decimal_to_ip that receives a single number (in decimal format) and returns the IPv4 address. Example:
>>> decimal_to_ip(3_653_594_367) 184.108.40.206
Now let's reverse the logic to write the function
ip_to_decimal. Example of usage:
>>> ip_to_decimal("220.127.116.11") 1742407679
(Check the hint if you're having issues implementing this function)
Enter the region name exactly as it is, without quotes or punctuation signs.
We won't use those columns, so better we drop them. Drop the columns in place modifying the
If you make a mistake, you'll need to re-read the whole dataframe. Your Dataframe needs to look similar to this:
Create two new columns
ipv4_to that contain the IP Addresses in IPv4 format of
ip_to respectively. Your Dataframe will look something like:
This is a more conceptual-type of activity to make sure the ranges are well understood, and set the tone for the following activities...
Let's keep analyzing ranges... How many total IP addresses are contained in this range?
Final counting activity...
Throughout the entire dataset
ip_range_df, how many IP addresses are assigned to the
city_name New York City?
ip_range_dfthat belong to
It should look something like:
Now it's time to unfold that dataframe of IP Ranges into real IPv4 addresses. Generate a new dataframe
ar_uy_df that contains the ENTIRE list of IP Addresses assigned to Argentina and Uruguay. The IP address should be contained in a column named
ip_addr and it should be the index of the dataframe. It should look something like this (note the index and the name of the column):
WARNING: The sorting done in the previous activity is key to get this activity right.