Efficient Python Part 1: Start with the Basics
Hey data guys, especially python lovers!
Who has never had to deal with refactoring their code, or improving performance? This is an almost daily subject for Devs and Data Engineers alike. After a few years of writing, rewriting, researching, studying and getting lots of feedback from more experienced colleagues; together with the python course on how to write python more efficiently provided by Datacamp, I decided to write this post.
In fact, I will write a series of 4 posts, where I will cover the following topics in each one:
- Efficient Python Part 1: Start with the Basics
- Efficient Python Part 2: Tools for Evaluating Your Code
- Efficient Python Part 3: Increasing code performance
- Efficient Python Part 4: Optimization for Pandas
Efficient Python 1: Start with the Basics
We can start by doing something simple: take advantage of already existing python standard python libraries, and the code best practices to become more efficient.
- Write clean as faster codes -> suggest reading the PEP8 Guide https://peps.python.org/pep-0008/
- Profile code bottlenecks -> We gonna see a bit later