Vani Nalliappan has Published 130 Articles

Python Pandas – How to use Pandas DataFrame tail( ) function

Vani Nalliappan

Vani Nalliappan

Updated on 27-Feb-2021 11:14:36

411 Views

Write a Python code to find price column value between 30000 to 70000 and print the id and product columns of the last three rows from the products.csv file.Download the products.csv file here.Result for price column value between 30000 to 70000 and id and product columns last three rows are −  ... Read More

Write a program in Python to verify camel case string from the user, split camel cases, and store them in a new series

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:26:35

622 Views

The result for splitting camel case strings into series as, enter the sring: pandasSeriesDataFrame Series is: 0    pandas 1    Series 2    Data 3    Frame dtype: objectTo solve this, we will follow the steps given below −SolutionDefine a function that accepts the input stringSet result variable with ... Read More

Write a Python code to combine two given series and convert it to a dataframe

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:25:31

140 Views

Assume, you have two series and the result for combining two series into dataframe as,  Id Age 0 1 12 1 2 13 2 3 12 3 4 14 4 5 15To solve this, we can have three different approaches.Solution 1Define two series as series1 and series2Assign first series into ... Read More

Write a program in Python to split the date column into day, month, year in multiple columns of a given dataframe

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:22:14

10K+ Views

Assume, you have a dataframe and the result for a date, month, year column is,       date  day  month  year 0 17/05/2002 17   05    2002 1 16/02/1990 16   02    1990 2 25/09/1980 25   09    1980 3 11/05/2000 11   05    2000 ... Read More

Write a Python code to convert a given series into a dummy variable and drop any NaN values if they exist

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:20:58

123 Views

Assume, you have a series and the result for converting to dummy variable as,    Female Male 0    0    1 1    1    0 2    0    1 3    1    0 4    0    1 5    0    0 6    1 ... Read More

Write a program in Python to convert a given dataframe to a LaTex document

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:20:06

118 Views

Assume, you have a dataframe and the result for converted to latex as, \begin{tabular}{lrr} \toprule {} &   Id &  Age \ \midrule 0 &    1 &    12 \ 1 &    2 &    13 \ 2 &    3 &    14 \ 3 &   ... Read More

Write a program in Python to generate an even (length) series of random four-digit pin. Get the length from user and ask until it’s valid

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:18:12

260 Views

The result for generating even length random four-digit pin numbers as, enter the series size 4 Random four digit pin number series 0    0813 1    7218 2    6739 3    8390To solve this, we will follow the steps given below −SolutionCreate an empty and list and set ... Read More

Write a program in Python to filter City column elements by removing the unique prefix in a given dataframe

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:16:20

241 Views

Assume you have a dataframe, the result for removing unique prefix city names are,   Id  City 2 3 Kolkata 3 4 Hyderabad 6 7 Haryana 8 9 Kakinada 9 10 KochinTo solve this, we will follow the steps given below −SolutionDefine a dataframeCreate an empty list to append all ... Read More

Write a program in Python Pandas to convert a dataframe Celsius data column into Fahrenheit

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:15:10

3K+ Views

The result for converting celsius to Fahrenheit as,  Id Celsius Fahrenheit 0 1  37.5    99.5 1 2  36.0    96.8 2 3  40.0    104.0 3 4  38.5    101.3 4 5  39.0    102.2To solve this, we will follow below approaches −Solution 1Define a dataframe with ‘Id’ and ... Read More

Write a program to append Magic Numbers from 1 to 100 in a Pandas series

Vani Nalliappan

Vani Nalliappan

Updated on 25-Feb-2021 07:12:27

540 Views

The result for appending magic numbers from 1 to 100 is, magic number series: 0       1 1       10 2       19 3       28 4       37 5       46 6       55 7 ... Read More

Advertisements