Python Articles

Page 210 of 855

How to find the frequency of a particular word in a cell of an excel table using Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 835 Views

Finding the frequency of a specific word in Excel cells is useful for data analysis and text processing. Python's pandas library provides an efficient way to read Excel files and count word occurrences. We'll demonstrate using a sample Excel file sampleTutorialsPoint.xlsx containing cricket player data. Sample Excel Data Player Name Age Type Country Team Runs Wickets Virat Kohli 33 Batsman India Royal Challengers Bangalore 6500 20 Mahendra Singh Dhoni 39 Batsman India Chennai Super Kings 4600 0 Rashid Khan 24 Bowler Afghanistan Gujarat Titans 500 130 Hardik ...

Read More

How to find the first empty row of an excel file in Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 3K+ Views

In this article, we will show you how to find the index of the first empty row in an Excel file using Python. This is useful for data processing tasks where you need to identify gaps in your data or find where to insert new records. We'll work with a sample Excel file called sampleTutorialsPoint.xlsx containing cricket player data with some empty rows ? Player Name Age Type Country Team Runs Wickets Virat Kohli 33 Batsman India Royal Challengers Bangalore 6300 20 Bhuvaneshwar Kumar 34 Batsman India Sun Risers Hyderabad 333 140 ...

Read More

How to Copy Odd Lines of Text File to Another File using Python

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 4K+ Views

In this article, we will show you how to copy only odd lines of a text file to another text file using Python. This is useful when you need to extract every alternate line starting from the second line. Assume we have a text file named TextFile.txt with some sample content. We need to copy all the odd-numbered lines (2nd, 4th, 6th, etc.) to another file. Sample Input File TextFile.txt Good Morning This is the Tutorials Point sample File Consisting of Specific source codes in Python, Seaborn, Scala Summary and Explanation Welcome everyone Learn with ...

Read More

How to Convert CSV to Excel using Pandas in Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 19K+ Views

In this article, we will show you how to convert a CSV file (Comma Separated Values) to an Excel file using the pandas module in Python. This is useful when you need to transform data into Excel format for reporting or sharing purposes. We'll use a sample CSV file called ExampleCsvFile.csv containing cricket player data to demonstrate the conversion process. Sample Data Our example CSV file contains the following player statistics ? Player Name Age Type Country Team Runs Wickets Virat Kohli 33 Batsman India Royal Challengers Bangalore 6300 20 ...

Read More

How to Find Line Number of a Given Word in text file using Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 4K+ Views

In this article, we will show you how to find the line number where a specific word appears in a text file using Python. This is useful for searching keywords in documents, logs, or code files. Let's assume we have a text file named TextFile.txt with the following content ? Good Morning TutorialsPoint This is TutorialsPoint sample File Consisting of Specific source codes in Python, Seaborn, Scala Summary and Explanation Welcome TutorialsPoint Learn with a joy Algorithm Following are the steps to find line numbers containing a specific word ? Open the ...

Read More

How to Write a List Content to a File using Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 4K+ Views

In this article, we will show you how to write list data to a text file using Python. There are several methods to accomplish this task, each with different formatting options. Writing List Elements Line by Line The most common approach is to write each list element on a separate line using a loop ? # Input list input_list = ['This', 'is', 'a', 'TutorialsPoint', 'sample', 'file'] # Write list elements to file (one per line) with open("ListDataFile.txt", 'w') as filedata: for item in input_list: ...

Read More

How to Remove Newline Characters from a text File?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 5K+ Views

When working with text files in Python, you often encounter newline characters () at the end of each line. This article demonstrates how to remove these newline characters using Python's built-in methods. Let's assume we have a text file called TextFile.txt with the following content: Good Morning TutorialsPoint This is TutorialsPoint sample File Consisting of Specific source codes in Python, Seaborn, Scala Summary and Explanation Welcome TutorialsPoint Learn with a joy Approach 1: Using rstrip() with List Comprehension The most common approach combines readlines() with rstrip() and list comprehension ? # Create a ...

Read More

How to Find the Shortest Words in a Text File using Python?

Vikram Chiluka
Vikram Chiluka
Updated on 26-Mar-2026 3K+ Views

In this article, we will show you how to find and print all the shortest words from a given text file using Python. The shortest words are those having the same length as the minimum length word in the file. We'll work with a sample text file containing various words of different lengths and extract all words that match the shortest length. Sample Text File Let's assume we have a text file called TextFile.txt with the following content ? Good Morning Tutorials Point This is the Tutorials Point sample File Consisting of Specific abbreviated source ...

Read More

Difference between Yield and Return in Python?

Pradeep Kumar
Pradeep Kumar
Updated on 26-Mar-2026 10K+ Views

In Python, yield and return are two fundamental keywords that serve different purposes in functions. While return terminates a function and sends a value back to the caller, yield creates a generator that can pause execution and resume later, making it ideal for memory-efficient iteration. What is Python Yield? The yield statement is used in generator functions to produce a sequence of values lazily. Unlike return, yield pauses the function's execution, saves its state, and allows it to resume from where it left off when called again. Example Here's how yield works in a generator function ...

Read More

Difference between Python and Lua

Pradeep Kumar
Pradeep Kumar
Updated on 26-Mar-2026 4K+ Views

Python and Lua are two prominent scripting languages widely used in modern software development. Both languages excel in different domains − Python dominates in data science, AI, and web development, while Lua is particularly popular in game development and embedded systems due to its lightweight nature. What is Python? Python is a high-level, interpreted programming language known for its simplicity and readability. Created by Guido van Rossum in 1991, Python emphasizes code readability with its clean syntax and extensive standard library. Python is the preferred choice for professionals in Artificial Intelligence, Machine Learning, Data Science, and web ...

Read More
Showing 2091–2100 of 8,546 articles
« Prev 1 208 209 210 211 212 855 Next »
Advertisements