How to read and write files in a directory with pathlib?

Today, we’ll explore how to read and write files using Python’s pathlib module. It provides methods to perform standard file operations without the need for importing other Python modules like os or shutil. Writing files with Python pathlib To begin, let’s assume we have a list of employee names and IDs that we want to … Read more

How to fill a pandas column with a date range object?

Convert Date Range to column in Pandas First, let’s create a DataFrame that we can work with. This DataFrame will represent basic employee information: We will now add a column to our DataFrame for storing a range of dates. In this scenario, we will populate this column with dates spanning couple days. We then assign … Read more

How to add a string to a path in Python using pathlib?

In this blog post, we’ll explore how to add a string to a path using pathlib, a library introduced in Python 3.4. The key benefit of the pathlib module is that it brings together the capabilities of many other Python modules like os.path, os, and glob into one object, making file system interactions way easier. … Read more

How to update values in PySpark DataFrames?

When working with PySpark DataFrames, you might need to update specific cell values in its rows and columns. This could be for data cleaning, transformations, or simply to correct errors. Create a Spark DataFrame Let’s consider that we have a DataFrame that contains employee data with the following columns: id, name, department, and salary. Update … Read more

Create shapes and change their color, shape with PowerPoint VBA

You can use Visual Basic for Applications (VBA) to automate repetitive tasks and add dynamic content to your presentations. One good example is to create and customize shapes. In this tutorial, i will show how to add a shape, change its properties like color and size, and manipulate it further using PowerPoint VBA. Open your … Read more

How to Use Variables in VBA MsgBox and InputBox in Excel and Word?

In this tutorial, we will explore how to utilize variables with the msgbox and inputbox functions to create dynamic dialog boxes. The code provided below will run in Microsoft 365 (or earlier) Excel, PowerPoint and Word applications. Using variables with MsgBox and InputBox can make your VBA dialog interactions more dynamic and user-friendly. In this … Read more