You are on page 1of 36

DATA HANDLING USING PANDAS – 1

1. Write a pandas program to multiple and divide two pandas series.


Sample series: [2,4,8,10], [1,3,7,9]

Input:

Output:
2. Write a pandas program to convert a dictionary to a pandas series
Sample dictionary: d1 = {‘a’:100, ‘b’:200, ‘c’:300}

Input:

Output:
3. Write a pandas program to sort a given Series
400, 300.12, 100, 200

Input:

Output:
4. Write a pandas program to change the order of index of a given
series
Original Data Series:
A 1
B 2
C 3
dtype: int64
Data Series after changing the order of index:
B 2
A 1
C 3
dtype: int64
Input:

Output:
5. Write a pandas program to get the items which are not common of
two given series.

Input:

Output:
6. Write a pandas program to create and display a Data frame from a
specified dictionary with index labels.

Input:

Output:
7. Write a pandas program to get the first three rows of a given Data
frame.

Input:

Output:
8. Write a pandas program to count the number of rows and columns of
a Data frame.

Input:

Output:
9. Write a Pandas program to select the rows the score between 15 and
20 (inclusive).

Input:

Output:
10. Write a pandas program to sort the Data frame first by ‘name’ in
descending order, then by ‘score’ in ascending order.

Input:

Output:
11. Write a pandas program to change the name ‘Manish’ to ‘Anish’
in name column if the data frame.

Input:

Output:
12. Write a pandas program to insert a new column in existing Data
Frame.

Input:

Output:
13. Write a pandas program to rename columns of a given Data
Frame.

Input:

Output:
14. Write a pandas program to delete Data Frame row(s) based on
given column value/ condition.

Input:

Output:
15. Write a pandas program to combining two series into a Data
Frame.

Input:

Output:
16. Write a pandas program to get the specified row value of a
given Data Frame.

Input:

Output:
17. Write a pandas program to insert a given column at a specific
column index in a Data frame.

Input:

Output:
18. Python Program to create the Data frame with the following
values.

Input:
Output:
19. Find total sales per employee in the above Data frame.

Input:

Output:
20. Find total sales by states in the above Data frame.

Input:

Output:
21. Find total sales by both Employee and state in above Data
frame.

Input:

Output:
22. Find Max individual sale by State in above Data frame.

Input:

Output:
23. Find the Mean, Median and min sales by State in above Data
frame.

Input:

Output:
24. Python program to create the Data frame with following values.
Name Year Score Catches
0 Mohak 2012 10 2
1 Rajesh 2012 22 2
2 Freya 2013 11 3
3 Aditya 2014 32 3
4 Anika 2014 23 3

Input:

Output:
25. Sort the Data frame’s row by score, in descending order.

Input:

Output:
26. Sort the data frame’s rows by catches and then by score, in
ascending order/ sort by multiple columns.

Input:

Output:
27. Sort the Data frame’s rows using index

Input:

Output:
28. Sort the data frame’s rows descending of index value.

Input:

Output:
29. Create a pandas series from a dictionary of values and an
ndarray.

Input:

Output:
30. Create a pandas series from a dictionary of values and an
ndarray.

Input:

Output:
31. Given a series, print all the elements that are above the 75 th
percentile.

Input:

Output:
32. Create a Data frame quarterly sales where each row contains
the item category, item name, and expenditure. Group the rows by
the category.

Input:

Output:
33. Create a data frame based on ecommerce data and generate
descriptive statistics(mean, median, mode, quartile, and variance).

Input:

Output:
34. Create a data frame for examination result and display row
labels, column labels data types pf each column and the dimensions

Input:

Output:

You might also like