Christopher Tao

AI

You Don’t Need Matplotlib When Pandas Is Enough for Data Visualisation

Created in Canva by Author One line of code to plot data makes routine EDA jobs easier Christopher Tao · Follow Published in Towards Data Science · 6 min read · 21 hours ago — It is very common to use data visualisation libraries such as Matplotlib, Seaborn, and Plotly. However, during the day-by-day ad hoc EDA analysis, I found that we may not have to use these libraries. In fact, the Pandas library itself

Read More »
AI

Pandas Indexes And Headers, Have You Ever Been Confused?

Created in Canva by Author From single-level index and headers to multi-level, why and how? Christopher Tao · Follow Published in Towards Data Science · 9 min read · 10 hours ago — There are so many tutorials about Pandas, but most of them are trying to tell us some tricks. I still remember when I was a newbie to the Python Pandas library, I used to be confused about the index and headers, especially

Read More »
AI

Optimizing Memory Consumption for Data Analytics Using Python — From 400 to 0.1

Created in Canva by Author Reducing the memory consumption of your code means reducing hardware requirements Christopher Tao · Follow Published in Towards Data Science · 9 min read · 2 hours ago — There are way many articles that tell us how to improve the performance of our code. Of course, the performance is critical, especially when we use Python for Data Analytics activities.

Read More »
AI

Why does an Integer Need 28 Bytes in Python?

Image from Canva.com Decomposition of an integer object in Python for memory consumption Christopher Tao · Follow Published in Towards Data Science · 7 min read · 12 hours ago — We all know that Python is famous for its flexibility and dynamic nature. However, have you think why it can achieve these and if there are any sacrifices? Of course, the specific mechanism of a programming language is too complex to be explained in

Read More »
AI

Python Decoration Is Very Useful, But When To Use Them?

Photo from Canva.com Summarised five typical usage patterns of Python decorators Christopher Tao · Follow Published in Towards Data Science · 9 min read · 7 hours ago — As one of the most unique features in Python, decorator might not be quite easy to understand. However, it will provide super conveniences to our development no matter if you are a Data Scientist, Data Engineer or Web Developer.

Read More »
AI

Understanding Race Conditions In the Context of Python

Image created in Canva by author Python GIL can’t guarantee thread safety Christopher Tao · Follow Published in Towards Data Science · 8 min read · 12 hours ago — No matter whether you are a Python user who uses threading frequently, or never used threading techniques but wants to try it in the future, there is one concept we can’t bypass. That is the thread safety. It refers to many different kinds of subtle

Read More »
AI

How to Use Python Built-In Decoration to Improve Performance Significantly

Image created in Canva by the author How to implement a caching mechanism in Python, and when not to use it? Christopher Tao · Follow Published in Towards Data Science · 9 min read · 3 hours ago — When talking about improving Python execution performance, especially for data processing, there are too many 3rd party libraries that can help us. If we think about their mechanisms, most of them rely on optimising the…

Read More »
AI

Python List Comprehension Is Not Just Syntactic Sugar

Image created by the author “Pythonic” is not a good reason. Why is the performance better? When not to use it? Christopher Tao · Follow Published in Towards Data Science · 8 min read · 13 hours ago — I guess you must find out there are too many articles telling us to use the list comprehension rather than a for-loop in Python. I have seen too many. However, I’m kind of surprised that there

Read More »
AI

You May Know This Design Pattern In Python, But When To Use It?

Image by Pexels from Pixabay From tutorial to practical examples of Python Singleton design pattern Christopher Tao · Follow Published in Towards Data Science · 8 min read · 8 hours ago — If you’re no longer a newbie to Python, one of the most important programming techniques called “Design Pattern” is a must-known one. Design patterns are usually best practices and the most effective approaches to solve some typical problems and requirements in software

Read More »
AI

Many Articles Tell You Python Tricks, But Few Tell You Why

Image by Annette from Pixabay Three common Python tricks make your program faster, I will explain the mechanisms Christopher Tao · Follow Published in Towards Data Science · 8 min read · 12 hours ago — Just had a simple search and it is very easy to get many articles trying to tell us many Python tricks. They are either more “Pythonic” or make our program faster. There is nothing wrong with these articles because

Read More »