Python __le__() Magic Method

Short summary: To customize the behavior of the less than or equal to operator x <= y, override the __le__() dunder method in your class definition. Python internally calls x.__le__(y) to obtain a return value when comparing two objects using x <= y. The return value can be any data type because any value can … Read more

Pandas Read and Write HTML Files

Over your career as a Data Scientist or a Web Scraper, there may be instances where you will work with data to/from a DataFrame to HTML format.  This article shows you how to manipulate this data using the above functions. This article covers the commonly used parameters for each function listed above. For a complete … Read more

Cómo convertir una lista de enteros en una lista de cadenas en Python

English version of article (English): https://blog.finxter.com/how-to-convert-an-integer-list-to-a-string-list-in-python/ La forma más pitónica de convertir una lista de enteros ints en una lista de cadenas es usar el código de una línea strings = [str(x) for x in ints]. Recorre todos los elementos de la lista ints y convierte cada elemento de la lista x en una cadena … Read more

How to Make Division by Zero to Zero in Python?

In Python, division by zero generates the exception ZeroDivisionError:  division by zero.  This is because in mathematics, division by zero is undefined. Today we’ll go over some ways to avoid the zero division error in Python and force it to return a zero. First, we’ll look into exception handling in Python. Second, we’ll examine different … Read more

Ethereum – Top 10 Articles to Get Started

Can you believe 5 years ago 1 ETH was priced at $9.33 USD?  ETH is now on the rise, priced at $4270.66 USD with growth showing 45,673.42%.  But wait, are you still not sure what Ethereum is?  Perhaps you’ve heard of it but only have a vague idea.  Not to worry.  I’ve compiled a list … Read more

Python __lt__() Magic Method

Short summary: To customize the behavior of the less than operator x < y, override the __lt__() dunder method in your class definition. Python internally calls x.__lt__(y) to obtain a return value when comparing two objects using x < y. The return value can be any data type because any value can automatically converted to … Read more

Python __gt__() Magic Method

Short summary: To customize the behavior of the greather than operator x > y, override the __gt__() dunder method in your class definition. Python internally calls x.__gt__(y) to obtain a return value when comparing two objects using x > y. The return value can be any data type because any value can automatically converted to … Read more

Python Dictionary values() Method

Definition The dict.values() method returns an iterable dictionary view object of all the values in a dictionary. Syntax dict.values() Parameters The dict.values() method does not take any parameters. Return-Value The dict.values() method returns an iterable dictionary view object of all the values in a dictionary. Error The dict.values() method does not take any parameters, so … Read more

Python Dictionary update() Method

Definition The dict.update() method updates a dictionary with a (key-value) pair element from another dictionary, or from an iterable of (key-value) pair elements. Syntax dict.update([dictionary/iterable]) Parameters The dict.update() method inputs either an iterable object of (key-value) pair elements (tuples in most cases), or another dictionary. Also, if the Python dict.update() method is applied to a … Read more

Python Dictionary setdefault() Method

Related Tutorial: Python Dictionary Methods Syntax dict.setdefault(key, default_value) Parameters The dict.setdefault() method takes two parameters, the key and the default_value of the key. The default value is optional. Return Value Returns the value associated with the passed key. If the key is not in the dictionary, returns the default value. If the key is not … Read more

Python Dictionary popitem() Method

Related Article: Python Dictionary Methods Definition The Python method dict.popitem() removes and returns the last (key-value) pair element that was inserted in the dictionary. Syntax dict.popitem() Parameters The dict.popitem() method does not take any parameter inputs. Return-Value The dict.popitem() method returns a tuple containing the last (key-value) pair element of the dictionary. It also removes … Read more