Vani Nalliappan has Published 130 Articles

Write a program in Python to print the elements in a series between a specific range

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:17:16

723 Views

Input − Assume, you have a series, 0    12 1    13 2    15 3    20 4    19 5    18 6    11Output − The result for the elements between 10 to 15 as, 0    12 1    13 2    15 6   ... Read More

Write a program in Python to count the total number of integer, float and object data types in a given series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:16:08

512 Views

Input − Assume, you have a series, 0    1 1    2 2    python 3    3 4    4 5    5 6    6.5Output −Total number of integer, float and string elements are, integer count: 5 float count: 1 string count: 1SolutionTo solve this, we will ... Read More

Write a program in Python to generate five random even index lowercase alphabets in a series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:14:05

58 Views

Solution 1Define lowercase alphabets in a list.Create for loop and find the even index elements and add it to another list. It is defined below   ls = []    for i in l:       if(l.index(i)%2==0):          ls.append(i)Finally, apply random sample 5 values to the list ... Read More

Write a program in Python to filter valid dates in a given series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:13:28

167 Views

Input − Assume, we have a Series, 0 2010-03-12 1 2011-3-1 2 2020-10-10 3 11-2-2Output − And, the result for valid dates in a series is, 0 2010-03-12 2 2020-10-10Solution 1Define a Series.Apply lambda filter method to validate a pattern in a series, data = pd.Series(l) result = pd.Series(filter(lambda x:re.match(r"\d{4}\W\d{2}\W\d{2}", ... Read More

Write a program in Python to replace all odd index position in a given series by random uppercase vowels

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:13:02

212 Views

Input − Assume, you have a Series, 0    1 1    2 2    3 3    4 4    5Output −And, the result after replacing odd index with uppercase vowels as follows −0    1 1    A 2    3 3    U 4    5SolutionDefine a ... Read More

Write a program in Python to filter only integer elements in a given series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:12:37

482 Views

Input − Assume you have the following series −0    1 1    2 2    python 3    pandas 4    3 5    4 6    5Output − The result for only integer elements are −0    1 1    2 4    3 5    4 6 ... Read More

Write a program in Python to check if a series contains duplicate elements or not

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:12:06

78 Views

Input − Assume, you have the following series, 0    1 1    2 2    3 3    4 4    5The above series contains no duplicate elements. Let’s verify using the following approaches.Solution 1Assume, you have a series with duplicate elements0    1 1    2 2   ... Read More

Python program to filter perfect squares in a given series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 06:03:23

438 Views

Input −Assume you have a series, 0    14 1    16 2    30 3    49 4    80Output −The result for perfect square elements are, 0    4 1    16 3    49Solution 1We can use regular expression and lambda function filter method to find the ... Read More

Python Pandas - Read data from a CSV file and print the ‘product’ column value that matches ‘Car’ for the first ten rows

Vani Nalliappan

Vani Nalliappan

Updated on 17-Feb-2021 06:26:32

704 Views

Assume, you have ‘products.csv’ file and the result for a number of rows and columns and ‘product’ column value matches ‘Car’ for the first ten rows are −Download the products.csv file here.Rows: 100 Columns: 8 id    product    engine    avgmileage    price    height_mm    width_mm    productionYear ... Read More

How to use Python Pandas to find the total number of count for more than one special characters present in each word in a given series?

Vani Nalliappan

Vani Nalliappan

Updated on 10-Feb-2021 12:39:30

507 Views

Input − Assume you have a series, 0       fruits!! 1       *cakes* 2       $nuts 3       #drinks dtype: objectInput − The result for the total number of counts for more than one special character in a series is 2.Let us ... Read More

Advertisements