Data Science

SQLite Python Placeholder – Four Methods for SQL Statements

Are you confusing about SQLite Python Placeholders? It’s time for better understanding! Learn how in this tutorial. Introduction SQLite is an embedded open-source relational database engine. Its developers, from SQLite.org, call it a self-contained, serverless, zero-configuration, fast, reliable and transactional SQL database engine.  It keeps things simple. SQLite “just works.” The SQLite library is also …

SQLite Python Placeholder – Four Methods for SQL Statements Read More »

List Difference | The Most Pythonic Way

Short answer: The most Pythonic way to compute the difference between two lists l1 and l2 is the list comprehension statement [x for x in l1 if x not in set(l2)]. This works even if you have duplicate list entries, it maintains the original list ordering, and it’s efficient due to the constant runtime complexity …

List Difference | The Most Pythonic Way Read More »

Python Freelancing | How to Exploit This Disruptive Mega Trend (as a Coder)

Short summary of the main points in the video: Freelancing is a mega-trend that will disrupt the organization of the world’s labor in the next 10-20 years. Freelancing platforms such as Upwork and Fiverr grow at 20% per year. You can participate in this trend by focusing on one tiny niche—and become world-class at it. …

Python Freelancing | How to Exploit This Disruptive Mega Trend (as a Coder) Read More »

The Most Pythonic Way to Convert a List to a String

To convert a list lst of strings to a string, use the ”.join(lst) method with an empty separator string between the elements. If you have a list of objects, first convert each element to a string and join the result with the generator expression ”.join(str(x) for x in lst). Problem: Given a list of elements. …

The Most Pythonic Way to Convert a List to a String Read More »

Python Join List of DataFrames

To join a list of DataFrames, say dfs, use the pandas.concat(dfs) function that merges an arbitrary number of DataFrames to a single one. When browsing StackOverflow, I recently stumbled upon the following interesting problem. By thinking about solutions to those small data science problems, you can improve your data science skills, so let’s dive into …

Python Join List of DataFrames Read More »

How to Convert a List to a NumPy Array?

To convert a Python list to a NumPy array, use either of the following two methods: The np.array() function that takes an iterable and returns a NumPy array creating a new data structure in memory. The np.asarray() function that takes an iterable as argument and converts it to the array. The difference to np.array() is …

How to Convert a List to a NumPy Array? Read More »

[Collection] 10 Best NumPy Cheat Sheets Every Python Coder Must Own

Little time to learn NumPy? This article shows you the ten most amazing NumPy cheat sheets. Download them, print them, and pin them to your wall β€” and watch your data science skills grow! πŸ±β€πŸ All NumPy cheat sheets in this article are 100% free. All links open in a new tab (so feel free …

[Collection] 10 Best NumPy Cheat Sheets Every Python Coder Must Own Read More »

The Ultimate Guide to NumPy Cumsum in Python

Definition np.cumsum(x): The function computes the cumulative sum of a NumPy array. For an array x with elements [a b c d] the cumulative sum is [a a+b a+b+c a+b+c+d]. Formally, each array element with index i is the sum of all elements with index j<i. numpy.cumsum(a, axis=None, dtype=None, out=None) Arguments: a — Array-like data …

The Ultimate Guide to NumPy Cumsum in Python Read More »

[NumPy vs Python] What are Advantages of NumPy Arrays over Regular Python Lists?

The Python built-in list data type is powerful. However, the NumPy array has many advantages over Python lists. What are they? Advantages NumPy Advantages Python Lists Multi-dimensional Slicing Library-Independent Broadcasting Functionality Intuitive Processing Speed Less Complicated Memory Footprint Heterogeneous List Data Allowed Many Convenience Methods Arbitrary Data Shape (Non-Square Matrix) Let’s dive into the most …

[NumPy vs Python] What are Advantages of NumPy Arrays over Regular Python Lists? Read More »