Server Side Programming Articles

Page 22 of 2109

Modify Equal Tuple Rows in Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 27-Mar-2026 144 Views

In this article we will learn how to modify equal tuple rows with the help of Python programming. When working with nested data structures, we sometimes need to selectively modify specific rows that match certain criteria. Understanding the Problem The problem is to modify specific tuple rows in a list based on equality matching. We have a list containing sublists of tuples, and we want to modify only those sublists that match our test criteria. Here's a visual representation of the concept: Original List: ...

Read More

How to move and overwrite files and folders using Python?

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 27-Mar-2026 4K+ Views

Moving and overwriting files and folders is a common task in Python automation. Python provides the shutil and os modules to handle these operations efficiently. Understanding shutil and os Modules The shutil module provides high-level file operations like copying, moving, and removing files and directories. The os module offers operating system interface functions for file and directory management. Moving Files To move a file, use shutil.move() which handles both moving and renaming operations ? import os import shutil # Create sample file for demonstration os.makedirs('source_folder', exist_ok=True) with open('source_folder/sample.txt', 'w') as f: ...

Read More

Finding the Summation of Nested Record Values in Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 27-Mar-2026 169 Views

The problem statement requires finding the summation of nested record values using Python. Sometimes we need to add values present in nested dictionaries, which is useful for data manipulation and aggregation tasks using dictionary keys. Understanding the Problem We need to find the addition of values in nested records (dictionaries). A nested dictionary is a dictionary containing other dictionaries as values. Our goal is to find nested values and sum them appropriately. Method 1: Sum All Values in Nested Records This approach recursively traverses the nested dictionary and sums all numeric values ? Algorithm ...

Read More

Finding the Summation of Nested Dictionary Values in Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 27-Mar-2026 1K+ Views

Sometimes we need to sum up values in nested dictionaries. In this article, we'll explore different approaches to find the summation of nested dictionary values using Python. Understanding the Problem A nested dictionary is a dictionary that contains other dictionaries as values. Our goal is to find and sum all numeric values within these nested structures. This is useful for aggregating data in hierarchical formats like JSON or configuration files. Method 1: Sum All Nested Dictionary Values This approach recursively traverses the nested dictionary and sums all numeric values it encounters ? Algorithm ...

Read More

Find the Mirror Image of a String using Python

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 27-Mar-2026 702 Views

In the given problem statement we are required to find the mirror image of a given string with the help of Python code. Understanding The Problem The problem at hand is to find the mirror image of the given string. The mirror image is the changed version of the given string in which every character is replaced with the mirror image of that character. Or we can say it is the reflection of the string. In real life we see ourselves in the mirror so our right part is visible in the left side in the mirror and ...

Read More

iconphoto() method in Tkinter - Python

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 2K+ Views

Tkinter is a Python library used for creating graphical user interfaces (GUIs). The iconphoto() method allows you to set custom icons for your Tkinter application window, enhancing visual appeal and creating a professional branded experience. Understanding the iconphoto() Method The iconphoto() method sets custom icons for Tkinter windows. The icon appears in the title bar, taskbar, and Alt+Tab menu. This method accepts image objects as parameters and applies them as window icons. Syntax root.iconphoto(default, *args) Parameters default: Boolean value − True sets icon for both window and application, False sets only ...

Read More

How to Zip two lists of lists in Python?

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 3K+ Views

Two lists of lists can be merged in Python using the zip() function. Combining two lists of lists is particularly valuable when dealing with tabular or multidimensional data, as it allows for combining related information from different sources. The zip() function pairs corresponding elements from sublists and generates a new structure. Algorithm A general algorithm to zip two lists of lists is as follows − Create two lists of lists, list1 and list2, with the same number of sublists Initialize an empty list to store the zipped results ...

Read More

How to write Pandas DataFrame as TSV using Python?

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 6K+ Views

A Pandas DataFrame can be written as a Tab-Separated Value (TSV) file using the to_csv() method. TSV is a common format for storing tabular data where columns are separated by tabs instead of commas. Syntax df.to_csv(file_path, sep='\t', index=False, header=True) Parameters file_path: Path and name of the output TSV file sep: Column separator. Use '\t' for tab separation index: Whether to include row indices. Set False to exclude header: Whether to include column names as first row Basic Example Here's how to write a DataFrame containing employee data to a TSV ...

Read More

How to write a simple Flask API for hello world?

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 784 Views

Flask is a lightweight web framework written in Python that allows developers to quickly build web applications and APIs. It provides a simple and elegant way to create RESTful APIs with minimal code. In this article, we will walk through the process of creating a simple Flask API that returns a "Hello, World!" message. Prerequisites Before we start, make sure you have the following installed on your machine: Python (version 3.6 or above) Flask (can be installed using pip) Algorithm A generic algorithm for writing any simple ...

Read More

How to verify Pyspark dataframe column type?

Rohan Singh
Rohan Singh
Updated on 27-Mar-2026 2K+ Views

PySpark, the Python API for Apache Spark, provides a powerful framework for big data processing. When working with PySpark DataFrames, verifying column data types is essential for data integrity and accurate operations. This article explores various methods to verify PySpark DataFrame column types with practical examples. Overview of PySpark DataFrame Column Types A PySpark DataFrame represents distributed data organized into named columns. Each column has a specific data type like IntegerType, StringType, BooleanType, etc. Understanding column types enables proper data operations and transformations. Using the printSchema() Method The printSchema() method displays the DataFrame's schema structure, showing ...

Read More
Showing 211–220 of 21,090 articles
« Prev 1 20 21 22 23 24 2109 Next »
Advertisements