Md Waqar Tabish

Md Waqar Tabish

18 Articles Published

Articles by Md Waqar Tabish

Page 2 of 2

Difference between series and vectors in Python Pandas

Md Waqar Tabish
Md Waqar Tabish
Updated on 27-Mar-2026 1K+ Views

Pandas is a powerful Python library for data manipulation and analysis. Two fundamental concepts often confused are Series and vectors. While a Series is a labeled one-dimensional array in Pandas, a vector typically refers to a one-dimensional NumPy array or a Series containing only numerical data. This article explores their key differences and usage patterns. What is a Pandas Series? A Pandas Series is a one-dimensional labeled array that can hold any data type including integers, floats, strings, and objects. It combines the functionality of both lists and dictionaries, providing both positional and label-based indexing. Key Parameters ...

Read More

How to match whitespace in python using regular expressions

Md Waqar Tabish
Md Waqar Tabish
Updated on 26-Mar-2026 20K+ Views

Regular expressions (RegEx) are powerful tools for matching patterns in text strings. The metacharacter "\s" specifically matches whitespace characters in Python, including spaces, tabs, newlines, and other whitespace characters. What are Whitespace Characters? Whitespace characters represent horizontal or vertical space in text. Common whitespace characters include: Space ( ) Tab (\t) Newline () Carriage return (\r) Form feed (\f) Vertical tab (\v) Syntax Here are the main patterns and functions for matching whitespace: # Using \s metacharacter result = re.findall(r'\s', text) # Using character class result = re.findall(r'[\s]', text) ...

Read More

How do we find the exact positions of each match in Python's regular expression?

Md Waqar Tabish
Md Waqar Tabish
Updated on 26-Mar-2026 2K+ Views

Regular expressions in Python allow us to search for patterns in text. When working with matches, it's often useful to know not just what matched, but exactly where each match occurred. Python's re module provides several methods to find the precise positions of matches. Key Methods for Finding Match Positions The following methods help locate match positions ? re.finditer() − Returns an iterator of match objects for all matches match.start() − Returns the starting position of a match match.end() − Returns the ending position of a match match.span() − Returns both start and end positions as ...

Read More

Why do we use question mark literal in Python regular expression?

Md Waqar Tabish
Md Waqar Tabish
Updated on 02-Nov-2023 4K+ Views

Introduction The question mark makes the previous token in the regular expression optional. For example: colou?r is complementary to both colour and colour. A quantifier is what the question mark is known as. You may make multiple tokens optional by combining numerous tokens in parentheses and adding the question mark after the final set of parentheses. Like Nov(ember)? matches between Nov and Nov. Using many question marks, you may create a regular expression matching a wide range of options. Feb(ruary)? 23(rd)? Matches February 23rd, February 23, Feb 23rd and Feb 23. Curly braces can also be used to make something ...

Read More

How can I use Python regex to split a string by multiple delimiters?

Md Waqar Tabish
Md Waqar Tabish
Updated on 02-Nov-2023 26K+ Views

Classes that encompass a collection of characters are known as regular expression classes. One of these classes, d, which matches any decimal digit, will be used. Learning how to split data may be valuable. Data arrives in various kinds and sizes, and it's sometimes not as clean as we'd like. You frequently wish to divide a string by more than one delimiter to make it easier to deal with. The built-in regular expression library re is the easiest way to split a string. The library has a.split() function that works similarly to the above example. This approach stands out since ...

Read More

How to extract date from text using Python regular expression?

Md Waqar Tabish
Md Waqar Tabish
Updated on 02-Nov-2023 12K+ Views

We must first understand some regular expression fundamentals as we will use them. There are various ways to declare patterns in regular expressions, which might make them appear complex but are pretty simple. Regular expressions are patterns that can be used to match strings that adhere to that pattern. You need to read the following article to learn how regular expressions operate. You may commonly extract dates from a given text when learning to code. If you are automating a Python script and need to extract specific numerical figures from a CSV file, if you are a data scientist and ...

Read More

How can I subtract a day from a Python date?

Md Waqar Tabish
Md Waqar Tabish
Updated on 27-Aug-2023 29K+ Views

Introduction It is essential to have a module that can modify date and time since, as we all know, they are utilized in applications where we must keep track of date and time. A DateTime module in Python deals with dates and times (Python Date/Time Tutorial). Python comes with a built-in datetime module. Installation of two new libraries is necessary before any data modification may take place. Dates and timings are quickly retrieved using the arrow library. A DataFrame may be accessed and used thanks to the Pandas library. Go to an IDE console to install these libraries. ...

Read More

How to escape any special character in Python regular expression?

Md Waqar Tabish
Md Waqar Tabish
Updated on 04-Apr-2023 3K+ Views

Regex, often known as regexp, is a potent tool for finding and manipulating text strings, especially when processing text files. Regex may easily replace many hundred lines of computer code with only one line. All scripting languages, including Perl, Python, PHP, JavaScript, general-purpose programming languages like Java, and even word processors like Word, support Regex for text searching. Regex may be challenging to learn because of its complicated syntax, but it is time well spent. Special Characters Text processing becomes more challenging when special characters are included because context must be carefully considered. You must think about what you see, ...

Read More
Showing 11–18 of 18 articles
« Prev 1 2 Next »
Advertisements