I’ve been on vacation and spend the last two days catching up and not doing a lot of learning, so I’ve been lazy in putting up TIL posts. That is over. (I did, however, push some updates to my Apple Photos Analysis project.) Here is a small collection of things I learned in the last week.
Amending commits
Say you forgot to add a file to your last commit or you made a typo in your commit message. You can amend it!
Make the necessary changes, then do this:
If you’ve already pushed it to an external repository, you’ll need to force the push since the external repo will look like it is ahead. If branch protection is turned on, you’ll need to make a new commit. Make sure you aren’t overwriting anything important!
Adding data labels to the top of bar charts in Matplotlib
Matplotlib is a great plotting library for Python.
Saving images in matplotlib
Counting items that match a regex pattern
Splitting!
Splitting by a space ' '
and choose the item after the split ([1]
because counting starts at 0)