Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plots showing frequency of earthquake and average magnitudes #12

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Pete-R-Jones
Copy link

@Pete-R-Jones Pete-R-Jones commented Oct 28, 2021

@Pete-R-Jones Pete-R-Jones changed the title Plot showing frequency of earthquake Plot showing frequency of earthquake and average magnitudes Oct 28, 2021
@Pete-R-Jones Pete-R-Jones changed the title Plot showing frequency of earthquake and average magnitudes Plots showing frequency of earthquake and average magnitudes Oct 28, 2021
Copy link
Collaborator

@ageorgou ageorgou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice plots!

Comment on lines +60 to +63
for indx, year in enumerate(years):
if get_year(earthquake) == year:
frequency[indx] +=1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified if you used a dictionary to map years to counts directly. That way you wouldn't need the inner loop of searching for the right year. Similarly for the loops below.

In general, nested loops like this can decrease performance because of the number of iterations they lead to, so try to avoid them when possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants