Python __hash__() Magic Method

Syntax object.__hash__(x) The Python __hash__() method implements the built-in hash() function. So, when you cal hash(x), Python attempts to call x.__hash__(). If the return value is not an integer or the x.__hash__() method is not defined, Python will raise a TypeError. We call this a “Dunder Method” for “Double Underscore Method” (also called “magic method”). … Read more

Python __complex__() Magic Method

Syntax object.__complex__(x) The Python __complex__() method implements the built-in complex() function. So, when you cal complex(x), Python attempts to call x.__complex__(). If the return value is not a complex number or the x.__complex__() method is not defined for an object on which you call complex(x), Python will raise a TypeError. We call this a “Dunder … Read more

Reading and Writing XML with Pandas

In this tutorial, we will learn how to read XML documents into a Pandas data frame using the read_xml() function and how to render a data frame into an XML object with the to_xml() function. Being able to work with XML documents in Pandas is very useful since we often find data stored in the … Read more

Python math.factorial()

This article is an edited version of this article on the Finxter blog. The math.factorial() function is one of many functions in the math module. In this article, we will explore the mathematical properties of the factorial function using Python’s Matplotlib and NumPy libraries. What is the Factorial Function? A factorial of a positive integer … Read more

Python Working with the Pandas DataFrame & MySQL – Part 2

Background Part 2 of this series centers around running more complex MySQL queries. This skill is a must-have if you are interested in pursuing a career as a Data Scientist. After completing Part 1 of this series, you should be comfortable: Installing Libraries Downloading and saving a CSV file from the web. Creating a Pandas … Read more

Python Working with the Pandas DataFrame & MySQL – Part 1

Background To provide a solid understanding of data manipulation using the Pandas DataFrame and MySQL, the Finxter Academy has created a 3-part series to take the user from beginner to advanced. This article assumes you have access to a localhost/server with MySQL. Part 2 and Part 3 also assumes you possess the login credentials with … Read more

Finxter Feedback from ~1000 Python Developers

This feedback is the collective feedback of a year’s worth of teaching hundreds of thousands of coders in our email program. Here’s the quick overview chart of all 955 responses: In case you want to join the email academy, check it out here: Let’s get started with the unfiltered list of feedback! List of 1000 … Read more

Python __bytes__() Magic Method

Syntax object.__bytes__(self) The Python __bytes__() method implements the built-in bytes() function. So, when you cal bytes(x), Python attempts to call x.__bytes__(). If the return value is not a Bytes object or the x.__bytes__() method is not defined for an object on which you call bytes(x), Python will raise a TypeError. We call this a “Dunder … Read more

Python __bool__() Magic Method

Syntax object.__bool__(self) The Python __bool__() method implements the built-in bool() function. So, when you cal bool(x), Python attempts to call x.__bool__(). If the return value is not a Boolean, Python raises a TypeError. We call this a “Dunder Method” for “Double Underscore Method” (also called “magic method”). To get a list of all dunder methods … Read more

Python __await__() Magic Method

The __await__() magic method defines the behavior of an awaitable object. An awaitable object is used to implement asynchronous behavior in Python. For example, you can implement an asynchronous function that waits for the data based to access some data like so (see source): Syntax __await__() object.__await__(self) The __await__() method must return an iterator. Otherwise, … Read more