My Life Expectancy and GDP portfolio project

Hello everyone,

I finished up this portfolio project a little while ago, but am finally feeling brave enough to post it to the forums. Here’s a link to the github repository which contains my code and write-up:

Any feedback you might have would be appreciated. Thanks for taking a look at my project, and for helping me be a little less scared of posting projects to the forums. :slight_smile:

Hi Michelle!

I’ve checked your project and I could appreciate from the very first moment all the hours that might have taken you to complete it. Congratulations, it’s great, all the investigation, and detail that you put in really show off. I only have one suggestion:

  • Next time you could try to write a loop or function that does the work for you. It seems like you wrote the same code over and over again for making the plots. I know it is really tempting to just copy and paste the lines that you know work’s fine and takes the job done, but I think you will be missing the most important ingredient of programming and that is, it was created for making things more simple for us and automate some processes that are repetitive.

This is a piece of code that I wrote for automating the scatter subplots. I hope this will help you notice how with a couple of lines of code you can do the same :slight_smile:

colors = [‘blue’, ‘gray’, ‘red’, ‘lightblue’, ‘purple’, ‘pink’]
countries = list(life_gdp_df.Country.unique())
for i in range(6):
x = list(life_gdp_df.Life_expectancy[life_gdp_df.Country == countries[i]])
y = list(life_gdp_df.GDP[life_gdp_df.Country == countries[i]])
plt.scatter(x, y, color = colors[i])
plt.title(countries[i] + ’ Life expectancy over GDP’)
plt.xlabel(‘Life expectancy’)