Vani Nalliappan has Published 130 Articles

Write a Python program to export dataframe into an Excel file with multiple sheets

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 10:10:19

750 Views

Assume, you have a dataframe and the result for export dataframe to multiple sheets as, To solve this, we will follow the steps given below −Solutionimport xlsxwriter module to use excel conversionDefine a dataframe and assign to dfApply pd.ExcelWriter function inside name excel name you want to create and set ... Read More

Write a Python program to separate a series of alphabets and digits and convert them to a dataframe

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 10:06:48

116 Views

Assume you have a series and the result for separating alphabets and digits and store it in dataframe as, series is: 0    abx123 1    bcd25 2    cxy30 dtype: object Dataframe is    0   1 0 abx 123 1 bcd 25 2 cxy 30To solve this, we ... Read More

Write a program in Python to filter armstrong numbers in a given series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 10:03:55

204 Views

Assume you have a series and the result for filtering armstrong numbers, original series is 0    153 1    323 2    371 3    420 4    500 dtype: int64 Armstrong numbers are:- 0    153 2    371 dtype: int64To solve this, we will follow the steps ... Read More

Write a Python program to shuffle all the elements in a given series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 10:01:05

173 Views

Assume, you have a dataframe and the result for shuffling all the data in a series, The original series is 0    1 1    2 2    3 3    4 4    5 dtype: int64 The shuffled series is : 0    2 1    1 2   ... Read More

Write a program in Python to covert the datatype of a particular column in a dataframe

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 09:58:53

71 Views

Assume, you have a dataframe, the result for converting float to int as, Before conversion Name      object Age       int64 Maths     int64 Science   int64 English   int64 Result    float64 dtype: object After conversion Name    object Age     int64 ... Read More

Write a Python code to swap last two rows in a given dataframe

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 09:56:07

522 Views

Assume you have dataframe and the result for swapping last two rows, Before swapping   Name    Age Maths Science English 0 David   13   98      75    79 1 Adam    12   59      96    45 2 Bob     12   66 ... Read More

Write a program in Python to remove one or more than one columns in a given DataFrame

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 09:50:56

124 Views

Assume, you have a dataframe,  one  two three 0 1    2    3 1 4    5    6And the result for removing single column is,  two three 0 2    3 1 5    6The result for removing after more than one column is,  three 0 3 1 ... Read More

Write a program in Python to find the most repeated element in a series

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 09:46:53

204 Views

Assume, you have the following series, Series is: 0    1 1    22 2    3 3    4 4    22 5    5 6    22And the result for the most repeated element is, Repeated element is: 22SolutionTo solve this, we will follow the below approach, Define ... Read More

Write a program in Python to select any random odd index rows in a given DataFrame

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 09:43:40

521 Views

Assume, you have a dataframe, DataFrame is:  id mark age 0 1 70   12 1 2 60   13 2 3 40   12 3 4 50   13 4 5 80   12 5 6 90   13 6 7 60   12And, the result for selecting any ... Read More

Write a program in Python to merge two dataframes based on matching data in a column

Vani Nalliappan

Vani Nalliappan

Updated on 24-Feb-2021 09:41:12

175 Views

Assume, you have two dataframe, first dataframe is  id country 0 1 India 1 2 UK 2 3 US 3 4 China second dataframe is  id City 0 1 Chennai 1 11 Cambridge 2 22 Chicago 3 4 ChengduAnd the result for merging based on same column is, ... Read More

Previous 1 ... 7 8 9 10 11 ... 13 Next
Advertisements