Python’s && Equivalent: Logical And

In Python, the equivalent of && (logical-and) in programming languages such as C++ or Java in an if-statement is and. Using && will raise a SyntaxError, so use and instead! Overview Problem: What is the equivalent of &&(logical-and) in Python? Example: Let’s have a look at the following example: Output: You will get the following … Read more

Pandas Hexbin, Hist, Pie, Scatter Plot

The Pandas DataFrame/Series has several methods related to plotting. Preparation Before any data manipulation can occur, four (4) new libraries will require installation. The Pandas library enables access to/from a DataFrame. The NumPy library supports multi-dimensional arrays and matrices in addition to a collection of mathematical functions. The Matplotlib library displays a visual graph of … Read more

Pandas Plotting – plot() & plot.area()

The Pandas DataFrame/Series has several methods related to plotting. Preparation Before any data manipulation can occur, three (3) new libraries will require installation. The Pandas library enables access to/from a DataFrame. The Matplotlib library displays a visual graph of a plotted dataset. The Scipy library allows users to manipulate and visualize the data. To install … Read more

Read from Stdin in Python

[toc] Problem Statement: Reading from stdin in Python. Reading inputs from the user is one of the fundamental building blocks that we learn while learning any programming language. The output of most codes depends on the user’s inputs. Hence, in this article, we are going to learn how to read from stdin in Python. There … Read more

Top 13 Python Tricks for Data Analysis

This article focuses on analyzing the coronavirus dataset using Python language. We are not using any of the Python data analysis libraries. Instead, we’ll use our raw Python skills to write a function, slicing, and indexing. Also, we’ll use Python arithmetic operators such as sum() and division. Finally, we’ll use a lambda expression to perform … Read more

Python Backtracking – A Helpful Guide with Video

You can check out the slides here (direct PDF link): Before we’ll dive into the algorithm and the Python implementation, let’s first skim over some related graph tutorials you may enjoy and that may help your understanding! Related Graph Tutorials This algorithm is part of our graph algorithm tutorials: Breadth-First Search (BFS) Algorithm in Python … Read more

Pandas resample(), to_period(), to_timestamp(), tz_localize(), tz_convert()

The Pandas DataFrame/Series has several methods related to time series. Preparation Before any data manipulation can occur, one (1) new library will require installation. The Pandas library enables access to/from a DataFrame. To install this library, navigate to an IDE terminal. At the command prompt ($), execute the code below. For the terminal used in … Read more

Cómo detener un bucle While en Python

Python proporciona tres formas de detener un bucle while: La condición del bucle while se comprueba una vez por iteración. Si se evalúa como False, el programa finaliza el bucle y procede con la primera instrucción después de la construcción del bucle. La palabra clave break termina un bucle inmediatamente. El programa procede con la … Read more