Vani Nalliappan has Published 103 Answers

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

Vani Nalliappan

Vani Nalliappan

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

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

Python Pandas – How to use Pandas DataFrame Property: shape

Vani Nalliappan

Vani Nalliappan

Updated on 27-Feb-2021 09:43:07

Write a Python program to read data from the products.csv file and print the number of rows and columns. Then print the ‘product’ column value matches ‘Car’ for first ten rowsAssume, you have ‘products.csv’ file and the result for number of rows and columns and ‘product’ column value matches ‘Car’ ... 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

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

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

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

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

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

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

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

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

1 2 3 4 5 6 7 ... 11 Next
Advertisements