Skip to content

Instantly share code, notes, and snippets.

@ma7dev
Last active January 14, 2022 07:51
Show Gist options
  • Save ma7dev/353a6f4ed1a54ee3cfd25627a6ea4a5a to your computer and use it in GitHub Desktop.
Save ma7dev/353a6f4ed1a54ee3cfd25627a6ea4a5a to your computer and use it in GitHub Desktop.
Refactored code from Effective Pandas by Matt Harrison talk
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ma7dev
Copy link
Author

ma7dev commented Aug 22, 2021

This code was inspired by Matt Harrison's presentation, Effective Pandas. In the presentation, Matt shows the following:

  1. Reducing the memory cost using Casting [1], which is a method to turn a data type of an object into another data type. From Matt's experiment, we saved 65.17% (10.97MB) from the original data. This could be improved even further by casting other columns.
  2. Writing Pandas operations in a cleaner and efficient way using Dot Notion Chaining.
  3. Comparing .apply method with other methods to broadcast operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment