Month: May 2021

How to Get Binance API Prices in Python at a Precise Time?

Problem Formulation Say, you want to get the current price of a cryptocurrency using Python’s inofficial binance API. How do you do this for a precise point in time? Step 1: Install Python Binance with pip If you haven’t already, install the Python Binance API using the pip package manager. Run pip install python-binance in …

How to Get Binance API Prices in Python at a Precise Time? Read More »

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 …

How to Get a Function Name as a String in Python? Read More »

How To Plot SKLearn Confusion Matrix With Labels?

Summary: The best way to plot a Confusion Matrix with labels, is to use the ConfusionMatrixDisplay object from the sklearn.metrics module. Another simple and elegant way is to use the seaborn.heatmap() function. Note: All the solutions provided below have been verified using Python 3.9.0b5. Problem Formulation Imagine the following lists of Actual and Predicted values …

How To Plot SKLearn Confusion Matrix With Labels? 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 …

How to Convert a Tensor to a NumPy Array in TensorFlow? Read More »

The Best Blockchain and Cryptocurrency Freelancing Platforms

Can you earn money for cryptocurrencies? With the increasing adoption of cryptocurrencies such as Bitcoin, Ethereum, and Cardano, the question naturally arise: can you sell your services for cryptocurrencies BTC, ETH, or ADA instead of USD, EUR, or CHF? The answer is: YES. And it gets better: the main idea of the blockchain is to …

The Best Blockchain and Cryptocurrency Freelancing Platforms 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 …

How to Check Your TensorFlow Version in Colab? 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, summing over cells …

How to Check the Pandas Version in Your Script? Read More »