The total number of lock exceeds the lock table size in MySQL

Below error when using python with sqlalchemy module and MySQL MariaDB. Error: MySQL is trying to tell you that it doesn’t have enough room to store all of the row locks that it would need to execute your query. The only way to fix it for sure is to adjust innodb_buffer_pool_size and restart MySQL. By default, thisContinue reading “The total number of lock exceeds the lock table size in MySQL”

Split String Column into Multiple Columns in Pandas DataFrame

You can use split() method to split a pandas DataFrame text column into multiple columns. Syntax: Parameters: Returns: The split() method returns a list of strings. The example below will split A column into two columns X and Y by expanding DataFrame dimensionality: Example: Output:

Chunking Large CSV file with pandas

When working with a large CSV file, instead of loading the entire file in memory for reading, you can read CSV files as chunks by reading only a part of the file at a time which uses very little memory. With the pandas read_csv() method by specifying the chunksize parameter, you can divide a largeContinue reading “Chunking Large CSV file with pandas”

Python Get MAC Address to allow Application only for specific Users

The main purpose of this post is how to allow only a specific user to use your CLI tool, and in this post, we’ll use a computer MAC address that provides a unique id of your computer hardware. Actually, it’s easy to achieve this because you only need three lines of code below to readContinue reading “Python Get MAC Address to allow Application only for specific Users”

What is a Python Dictionary?

A Python dictionary consists of a collection of key-value pairs with unique keys. The advantage of using a dictionary is quick access to an element by a key without having to search through a full dataset, which means you can achieve both performance gain and write more readable code. Dictionary Syntax: You need to knowContinue reading “What is a Python Dictionary?”

Python For Loop with Index

In this post, we’ll go over a different approach on how to access an index in Python’s for-loop statements. And remember, you can use for-loop statements only at iterable-object such as a list, tuple, dictionary, set, and string. To access the index in Python’s for-loop statement in this post, you can use: manual indexing variableContinue reading “Python For Loop with Index”

Understanding Python slice notation

Python slicing is a very powerful way to access parts of your data, so it’s one aspect of the language that every Python programmer needs to know. But first, you need to know the difference between indexing and slicing: Indexing Index position works as a pointer to an item of your iterable object or dataContinue reading “Understanding Python slice notation”

Working with CSV File with Pandas (Python)

A Comma Separated Values (CSV) is the simplest form of storing data in tabular form as a plain text file. And these files (CSV) are often used for data exchange between different applications or sometimes used as an input for data-processing to get an insight about the data and to visualize it. Challenge How toContinue reading “Working with CSV File with Pandas (Python)”

IndexError: index 0 is out of bounds for axis 0 with size 0

I often find this error “IndexError: index 0 is out of bounds for axis 0 with size 0”, especially when working with multiple arrays with Numpy and the same error can occur for those using Pandas when sending a Series or DataFrame to a numpy.array as with the following (Actually, Pandas is built on theContinue reading “IndexError: index 0 is out of bounds for axis 0 with size 0”