Tarandeep Singh

Tarandeep Singh

5 Articles Published

Articles by Tarandeep Singh

5 articles

How to Automate an Excel Sheet in Python?

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

Excel automation with Python allows you to manipulate spreadsheets programmatically, saving time and reducing manual errors. Python offers several powerful libraries for Excel automation: openpyxl for direct Excel file manipulation, pandas for data analysis operations, and xlwings for advanced Excel integration. Method 1: Using openpyxl Library The openpyxl library provides direct access to Excel files, allowing you to read, write, and modify spreadsheets cell by cell. Installation pip install openpyxl Example Let's create and manipulate an Excel file that adds bonus calculations to employee salaries − import openpyxl as xl ...

Read More

Get the day from a date in Pandas

Tarandeep Singh
Tarandeep Singh
Updated on 27-Mar-2026 10K+ Views

Pandas provides several methods to extract the day name from dates. Whether you're working with single dates or multiple date strings, you can use dt.dayofweek, dt.day_name(), or dt.strftime() to get day information in different formats. Using dt.dayofweek with Manual Mapping The dt.dayofweek property returns numeric values (0-6) for days, which you can map to day names ? import pandas as pd # Create a date range dates = pd.date_range(start='2022-01-01', end='2022-01-07') # Create a DataFrame with the dates df = pd.DataFrame({'date': dates}) # Add a column with the day of the week as numbers ...

Read More

Get the data type of column in Pandas - Python

Tarandeep Singh
Tarandeep Singh
Updated on 27-Mar-2026 19K+ Views

Pandas is a popular and powerful Python library commonly used for data analysis and manipulation. It offers data structures like Series and DataFrame for working with tabular data. Each column in a Pandas DataFrame can contain a different data type. This article covers various methods for determining column data types in a DataFrame ? Sample DataFrame Let's create a sample DataFrame to demonstrate different approaches ? import pandas as pd # Create a sample dataframe df = pd.DataFrame({ 'Vehicle name': ['Supra', 'Honda', 'Lamborghini'], 'price': [5000000, 600000, ...

Read More

Get tag name using Beautifulsoup in Python

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

BeautifulSoup is one of the most widely used Python packages for web scraping and parsing HTML and XML documents. One of the most common tasks when working with HTML and XML documents is extracting the tag name of specific elements. Python's BeautifulSoup library can be installed using the below command ? pip install beautifulsoup4 Using the name Attribute The most straightforward method to get tag names in BeautifulSoup is using the name attribute of the Tag object. This attribute returns a string value containing the name of the tag. Syntax tag.name ...

Read More

Get specific row from PySpark dataframe

Tarandeep Singh
Tarandeep Singh
Updated on 27-Mar-2026 11K+ Views

PySpark is a powerful tool for big data processing and analysis. When working with PySpark DataFrames, you often need to retrieve specific rows for analysis or debugging. This article explores various methods to get specific rows from PySpark DataFrames using functional programming approaches. Creating Sample DataFrame Let's create a sample DataFrame to demonstrate all the methods ? from pyspark.sql import SparkSession # Create SparkSession spark = SparkSession.builder.appName("get_specific_rows").getOrCreate() # Create sample DataFrame df = spark.createDataFrame([ ('Row1', 1, 2, 3), ('Row2', 4, 5, 6), ...

Read More
Showing 1–5 of 5 articles
« Prev 1 Next »
Advertisements