Hafeezul Kareem has Published 345 Articles

casefold() string in Python Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 02-Jan-2020 06:31:14

61 Views

In this tutorial, we are going to discuss the string method str.casefold(). It doesn't take any arguments. The return value of the method is a string that is suitable for the caseless comparisons.What are caseless comparisons? For example, the german lower case letter ß is equivalent to ss. The str.casefold() method ... Read More

Change data type of given numpy array in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 02-Jan-2020 06:23:52

11K+ Views

We have a method called astype(data_type) to change the data type of a numpy array. If we have a numpy array of type float64, then we can change it to int32 by giving the data type to the astype() method of numpy array.We can check the type of numpy array ... Read More

Number of operations required to make all array elements Equal in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 02-Jan-2020 06:11:25

362 Views

We have given an array of elements, and we have to make them all equal by incrementing the elements by 1. We are allowed to increment n - 1 element at each step. Our goal is to calculate the total number of operations required to make all the array elements ... Read More

Anagram Substring Search using Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 04-Nov-2019 07:41:41

150 Views

In this tutorial, we are going to write a program which searches for all the anagram from a string.See some examples.Input: anagram = "cat" string = "tacghactcat" Output: Anagram at 0 Anagram at 5 Anagram at 7 Anagram at 8Let's see how to write the code. Follow the below steps ... Read More

Anagram checking in Python program using collections.Counter()

Hafeezul Kareem

Hafeezul Kareem

Updated on 04-Nov-2019 07:22:52

70 Views

Two strings are said to be anagrams of each if they have same characters even in different order. In this tutorial, we are going to check for anagram in Python using the collections.Counter() method.Input: string_one = "cat" string_two = "tac" Ouput: Truecollections.Counter()collection.Counter() returns a dictionary which contains frerquency of each ... Read More

append() and extend() in Python program

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Nov-2019 09:53:04

383 Views

In this tutorial, we are going to learn about the most common methods of a list i.e.., append() and extend(). Let's see them one by one.append()append() method is used to insert an element at the end of a list. The time complexity of append() method is O(1).Syntaxlist.append(element) -> element can ... Read More

Apply function to every row in a Pandas DataFrame in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Nov-2019 09:50:20

974 Views

In this tutorial, we are going to learn about the most common methods of a list i.e.., append() and extend(). Let's see them one by one.apply()It is used to apply a function to every row of a DataFrame. For example, if we want to multiply all the numbers from each ... Read More

Apply uppercase to a column in Pandas dataframe in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Nov-2019 09:47:01

1K+ Views

In this tutorial, we are going to see how to make a column of names to uppercase in DataFrame. Let's see different ways to achieve our goal.ExampleWe can assign a column to the DataFrame by making it uppercase using the upper() method.Let's see the code.# importing the pandas package import ... Read More

Arithmetic Operations on Images using OpenCV in Python

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Nov-2019 09:45:00

573 Views

In this tutorial, we are going to learn about the arithmetic operations on Images using OpenCV. We can apply operations like addition, subtraction, Bitwise Operations, etc.., Let's see how we can perform operations on images.We need the OpenCV module to perform operations on images. Install the OpenCV module using the ... Read More

as_integer_ratio() in Python for reduced fraction of a given rational

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Nov-2019 09:42:09

243 Views

In this tutorial, we are going to write a program that returns two numbers whose ratio is equal to the given float value. We have a method called as_integer_ratio() that helps to achieve our goal.Let's see some examples.Input: 1.5 Output: 3 / 2 Input: 5.3 Output: 5967269506265907 / 1125899906842624Let's examine ... Read More

Advertisements