Helicopter Prison Escape - So Long Suckers

Hello all! Please have a look at my first data science project ‘Helicopter Prison Escapes!’. Any feedback is welcomed and will be much appreciated, enjoy the rest of your day!

Basics.ipynb (266.7 KB)

Best regards,
Shaun

Click here to view the jupyter notebook file in a new tab

1 Like

Hi @shaun.oilund, Great project for a start you did very well, your images and visualization were so on point, the introduction even though it’s concise also showed a perfect description of what the work is all about. The markdowns were quite descriptive and gave a clear explanation of the outcomes. It’s also admirable how you explained each code’s reasoning using comments.

However, why not consider putting the header that is Helicopter Prison Escapes! An Analysis of Attempted Prison Escapes via Helicopter before the image since that’s what the project is all about.

Anyway congratulations on finishing your first guided project. Good luck with the coming ones.

1 Like

Hello @OlutokiJohn! Thank you for looking through my project and for the feedback! I did think about putting the title first before the image. I went back and forth a few times and decided to go with a coin toss and I called “heads” for the image to go first. I had another look after I read your comment and I agree the title should have gone first before the image; thanks again!

Shaun

1 Like

Has anyone, tried the escapees part ??

@Gabriel-Dee , I’m going to go back and give the other prison escape questions a go after I work through the ‘for loop’ and conditional statement lessons again. I’ll post a Rev.2 of the project with the updates; but, there must be someone out there that has completed the bonus questions.

Help me out i am at the last stage of the project but at the last query the error of df not defined is showing and i cant understand why because the query is the same as mentioned in the instruction.
Please suggest

Could you paste your lines of code, I could have a look and see if there is something going on there.

countries_frequency = df[“Country”].value_counts()
print_pretty_table(countries_frequency)

this is the code i used and the error is as follows:
NameError Traceback (most recent call last)
in
----> 1 countries_frequency = df[“Country”].value_counts()
2 print_pretty_table(countries_frequency)
3 print(‘Table 1: Number of Helicopter Prison Escape Attempts per Country’)

NameError: name ‘df’ is not defined

I’m really not too sure why it would be giving you an error for ‘df not defined’. When I run into issues like that where the code appears to be correct but I’m getting errors or the code output is not what I expected I will click ‘Kernel’ and select ‘Restart & Run All’, give it try.

at In [4] why do we increment index by 1,

Noted will try this one time

it worked thank you.

1 Like

I find this step is confusing and counter intuitive so I’ll try to explain how I think it works.

The original data[index] is data[0, 1, 2, 3, 4, 5] or data[-6, -5, -4, -3, -2, -1] and represent each column in the dataset.

When you assign index to zero (index = 0) you are assigning a value of ‘0’ to a variable named ‘index’, a blank slate.

As for the ‘for’ loop,
for each row in the list of lists (data):

data[index] = row[:-1], this is to say the dataset index will include indices up to but not including index[-1]. As an alternative, you could write data[index] = row[:5] to achieve the same result.

Now, ‘index += 1’ instructs the loop to iterate over each row to only include the new index definition starting from the first row (0 + 1), then the 2nd row (1 + 1), the 3rd (2 + 1) …, etc., until the very last row (47 + 1).

Clear as mud I’m sure, but this is how I interpret the code, if this is incorrect or an incomplete explanation please let me know.

You’re welcome, I’m glad it worked!

hello everyone…i noticed my visualization is not showing blue lines…

what can I do

use your code in two different row
like :
1row: countries_frequency = df[“Country”].value_counts()
2row: print_pretty_table(countries_frequency)

Hello Everyone, I completed a Rev.2 of the Helicopter Prison Escape project and include a new section to answer one of the bonus questions: Which country would you have the best chance of success? It is different in several ways as some of the functions would not work in my Jupyter notebook; I also had some fun with bar charts.

I downloaded the data as a csv file and when I printed the data I noticed a bunch of unwanted characters attached to all topic in the Wikipedia article with links. I tried to clean it up but nothing I tried would work like replace() or translate() functions. Please let me know if anyone knows how to properly clean the data.

Helicopter_Prison_Escape_Rev_2.ipynb (366.7 KB)

Click here to view the jupyter notebook file in a new tab

2 Likes