How to Get a Function Name as a String in Python?

Problem Formulation Given a function object assigned to a name. How to get the name of the function as a string? For example, consider the following function your_function. How to get the name “your_function” from this? Your desired value of the result stored in string_name is the string “your_function”. Method 1: Use the __name__ Attribute … Read more

How to Lowercase a String in Python?

To convert a string to a lowercase string in Python, use the string.lower() built-in string method. This returns a lowercase string version. As you read over the explanations below, feel free to watch our video guide about this particular string method: If you want to perform case insensitive matching in languages such as German or … Read more

How to Insert an Element at the End of a List in Python

Problem Formulation Given a list and an element. How to insert the element at the last position of the list? Two Solutions There are two main ways to insert an element at the end of a given list. Use list.append(element) to add the element to the end of the list. This is the most idiomatic … Read more

How to Convert a Tensor to a NumPy Array in TensorFlow?

There are two ways to convert a Tensor to a NumPy array: TensorFlow version 2.x — use tensor.numpy() TensorFlow version 1.x — use tensor.eval(session=tf.compat.v1.Session()) Let’s dive into these two methods in greater detail. Method 1: Explicit Tensor to NumPy Array Conversion in TensorFlow 2.x To convert a tensor t to a NumPy array in TensorFlow … Read more

How to Check Your TensorFlow Version in Colab?

To check your TensorFlow version in your Jupyter Notebook such as Google’s Colab, use the following two commands: import tensorflow as tf This imports the TensorFlow library and stores it in the variable named tf. print(tf.__version__) This prints the installed TensorFlow version number in the format x.y.z. The following code example uses the dunder attribute … Read more

How to Check the Pandas Version in Your Script?

What is the Pandas Library? The pandas library provides data structures and functionality to represent and manipulate labelled and tabular data. Think of it as like an advanced spreadsheet program in your code with functionality includingβ€”but not limited to: creating spreadsheets, accessing individual rows by name, calculating basic statistics over rows and columns, and summing … Read more

Inheritance in Python

You have the eyes of your mother. One could say, you “inherited” the eyes of your mother. As you may have guessed, this article is about inheritance in Python. Inheritance is one of the most important features of object orientation. It’s a simple and intuitive concept but even advanced coders circumvent using inheritance because they … Read more

[FANG KILLER ICP] Will the Internet Computer Disrupt Big Tech?

What is the Internet Computer? The Internet Computer is blockchain technology and computing infrastructure initiated by the non-profit organization DFinity. Like the public Internet, the Internet Computer is a distributed computing platform consisting of thousands of connected and decentralized servers that host backend software. This idea mitigates the increasing monopolization of Internet services and enables … Read more