How to Search for Specific Files Only in Subdirectories in Python?

[toc] Problem Formulation: Let’s say we have a directory containing other subdirectories which further contain files. How do we search for a specific file in the subdirectories in our Python script? Scenario: We have a parent folder (Parent) with child folders (child_1, child_2, and child_3). There are files in the parent directory/folder as well as … Read more

pd.DataFrame.groupby() – A Simple Illustrated Guide

In Python, the pandas.DataFrame.groupby() function splits a pandas.DataFrame into subgroups. It is a part of a full groupby operation, where we usually split the data, apply a function, and then combine the result. Here is the argument table of pandas.DataFrame.groupby(). If it sounds great to you, please continue reading, and you will fully understand the … Read more

Data Preparation in Data Science

Data preparation is a crucial step in data science and data analytics. Data preparation is the process of cleaning and transforming raw data before analyzing and processing it further. It involves multiple steps such as gathering, assessing, cleaning, transforming, reformatting, correcting, filtering and combining data. Improving the data quality will usually lead to improved quality … Read more

How to Plot a Chord Diagram Using Python?

Do you know which data visualization tool is ideal for interrelation analysis? Is a bar chart a better choice for this? Certainly not.  The Chord Diagram is the best visualization tool for interrelation analysis. This graphical tool depicts how one entity is linked to others quantitatively. We can glean valuable information from this diagram. This … Read more

Extract File Name From the Path, No Matter What the os/path Format

Summary: os.path.basename(path) enables us to get the file name from the path, no matter what the os/path format. Another workaround is to use the ntpath module, which is equivalent to os.path. ✨Problem: How to extract the filename from a path, no matter what the operating system or path format is? For example, let’s suppose that … Read more

Mobile App Developer — Income and Opportunity

Before we learn about the money, let’s get this question out of the way: What Does a Mobile App Developer Do? A mobile app developer is a programmer who focuses on software creation for mobile devices such as smartphones or wearables. Most mobile app developers create smartphone apps for the Android, macOS, or Windows mobile … Read more

How to Measure Elapsed Time in Python?

Summary: You can evaluate the execution time of your code by saving the timestamps using time.time() at the beginning and the end of your code. Then, you can find the difference between the start and the end timestamps that results in the total execution time. [toc] Problem: Given a Python program; how will you measure … Read more

How to Fix ImportError: No module named pandas [Mac/Linux/Windows/PyCharm]

Quick Fix: Python raises the ImportError: No module named pandas when it cannot find the Pandas installation. The most frequent source of this error is that you haven’t installed Pandas explicitly with pip install pandas. Alternatively, you may have different Python versions on your computer, and Pandas is not installed for the particular version you’re … Read more

Desktop Developer — Income and Opportunity

Before we learn about the money, let’s get this question out of the way: What Is a Desktop Developer? Let’s have a look at the definition first: A desktop developer is a software developer creating software applications for desktop-based operating systems like macOS, Windows, and Linux. In some cases, these applications don’t require an uninterrupted … Read more