Guided Project: Visualizing The Gender Gap In College Degrees Luis

Guided Project: Visualizing The Gender Gap In College Degrees
I share with you the Guided Project so you can take a look at it. I did it so it will automatically put the name of the plots according to the data.
This was the result and the code!
I hope you can watch it and give me some thought of it.
Basics ().ipynb (155.0 KB)

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

1 Like

Hey @lurepor,

Thanks for sharing your work with the community. First of all I must say that you have done a great work. You have optimized your codes very well by using simple technics with advanced thinking. I really like it and have lot to learn from your codes.

However, I would like to suggest few things that can make your project even better.

  • It is better to start your project by giving a brief introduction about the data set, the objective of the project and flow of the work that you are going to do etc.

  • As well as it is a good practice to explain your code blocks with either comments or markdown cell. Specially it will help readers to understand your codes and logic behind your codes.

  • Finally, adding a conclusion is really important as many readers are interested to know your findings from these analysis without going through your codes.

I think these points will make your project better.
Keep it up.


Hi @lurepor

Good use of for loops to generate the plots! And I agree with all the points @Scylla mentioned.

Two addtional thoughts:

  • The part of your code, in which you define the ‘Men’/‘Women’ annotations can be written more concise, with the knowledge you probably have at this stage. If you are interested, maybe start thinking about, which subplots need annotations and how you can check within your already exisiting for-loop, which subplot is currently drawn. Then you just need to get the respective values for this iteration from the data, do some calculations regarding the placement of the labels and you reduced the code by a factor of 5. Let me know, if you want to have some further guidance or example code.

  • Code formatting: Firstly, it is a good practice to break your code up into logical chunks (with empty lines). This is basically an addition to the code comments @Scylla already hinted at. This makes reading code a lot easier. Secondly, I recommend limiting your line lengths. This is again helpful for people who review your code (and also for your future self). See example below

# Plot gender gaps for all college majors (categorized)
# Categories
stem_cats = ['Psychology',
             'Math and Statistics',
             'Physical Sciences',
             'Computer Science',

lib_arts_cats = ['Foreign Languages',
                 'Communications and Journalism',
                 'Art and Performance',
                 'Social Sciences and History'

other_cats = ['Health Professions',
              'Public Administration',

all_majors = [stem_cats, lib_arts_cats, other_cats]

# Init figure
fig = plt.figure(figsize=(12, 24))

# And so on, you get the idea..

Further info on good Python code style: PEP8